bug修复+代码调整+日志优化

This commit is contained in:
MaxKey 2024-09-29 07:10:13 +08:00
parent 65bc8c01b9
commit 8fe411648d
55 changed files with 724 additions and 5990 deletions

View File

@ -22,22 +22,22 @@ import org.dromara.maxkey.authn.jwt.AuthTokenService;
import org.dromara.maxkey.authn.provider.AbstractAuthenticationProvider;
import org.dromara.maxkey.configuration.ApplicationConfig;
import org.dromara.maxkey.constants.ConstsLoginType;
import org.dromara.maxkey.entity.Institutions;
import org.dromara.maxkey.entity.Message;
import org.dromara.maxkey.web.WebConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nimbusds.jwt.SignedJWT;
@Controller
@RestController
@RequestMapping(value = "/login")
public class HttpJwtEntryPoint {
private static final Logger _logger = LoggerFactory.getLogger(HttpJwtEntryPoint.class);
@ -54,11 +54,11 @@ public class HttpJwtEntryPoint {
@Autowired
JwtLoginService jwtLoginService;
@RequestMapping(value={"/jwt"}, produces = {MediaType.APPLICATION_JSON_VALUE})
@RequestMapping(value={"/jwt"}, produces = {MediaType.APPLICATION_JSON_VALUE},method={RequestMethod.GET,RequestMethod.POST})
public Message<AuthJwt> jwt(@RequestParam(value = WebConstants.JWT_TOKEN_PARAMETER, required = true) String jwt) {
try {
//for jwt Login
_logger.debug("jwt : " + jwt);
_logger.debug("jwt : {}" , jwt);
SignedJWT signedJWT = jwtLoginService.jwtTokenValidation(jwt);
@ -66,15 +66,15 @@ public class HttpJwtEntryPoint {
String username =signedJWT.getJWTClaimsSet().getSubject();
LoginCredential loginCredential =new LoginCredential(username,"",ConstsLoginType.JWT);
Authentication authentication = authenticationProvider.authenticate(loginCredential,true);
_logger.debug("JWT Logined in , username " + username);
_logger.debug("JWT Logined in , username {}" , username);
AuthJwt authJwt = authTokenService.genAuthJwt(authentication);
return new Message<AuthJwt>(authJwt);
return new Message<>(authJwt);
}
}catch(Exception e) {
_logger.error("Exception ",e);
}
return new Message<AuthJwt>(Message.FAIL);
return new Message<>(Message.FAIL);
}
/**
@ -82,25 +82,25 @@ public class HttpJwtEntryPoint {
* @param jwt
* @return
*/
@RequestMapping(value={"/jwt/trust"}, produces = {MediaType.APPLICATION_JSON_VALUE})
@RequestMapping(value={"/jwt/trust"}, produces = {MediaType.APPLICATION_JSON_VALUE},method={RequestMethod.GET,RequestMethod.POST})
public Message<AuthJwt> jwtTrust(@RequestParam(value = WebConstants.JWT_TOKEN_PARAMETER, required = true) String jwt) {
try {
//for jwt Login
_logger.debug("jwt : " + jwt);
_logger.debug("jwt : {}" , jwt);
if(authTokenService.validateJwtToken(jwt)) {
String username =authTokenService.resolve(jwt).getSubject();
LoginCredential loginCredential =new LoginCredential(username,"",ConstsLoginType.JWT);
Authentication authentication = authenticationProvider.authenticate(loginCredential,true);
_logger.debug("JWT Logined in , username " + username);
_logger.debug("JWT Logined in , username {}" , username);
AuthJwt authJwt = authTokenService.genAuthJwt(authentication);
return new Message<AuthJwt>(authJwt);
return new Message<>(authJwt);
}
}catch(Exception e) {
_logger.error("Exception ",e);
}
return new Message<AuthJwt>(Message.FAIL);
return new Message<>(Message.FAIL);
}

View File

@ -78,7 +78,7 @@ public class AuthnProviderAutoConfiguration {
}
@Bean
public ScanCodeAuthenticationProvider scanCodeAuthenticationProvider(
ScanCodeAuthenticationProvider scanCodeAuthenticationProvider(
AbstractAuthenticationRealm authenticationRealm,
SessionManager sessionManager
) {
@ -89,7 +89,7 @@ public class AuthnProviderAutoConfiguration {
}
@Bean
public AppAuthenticationProvider appAuthenticationProvider(
AppAuthenticationProvider appAuthenticationProvider(
AbstractAuthenticationRealm authenticationRealm,
ApplicationConfig applicationConfig,
SessionManager sessionManager,
@ -104,7 +104,7 @@ public class AuthnProviderAutoConfiguration {
}
@Bean
public MobileAuthenticationProvider mobileAuthenticationProvider(
MobileAuthenticationProvider mobileAuthenticationProvider(
AbstractAuthenticationRealm authenticationRealm,
ApplicationConfig applicationConfig,
SmsOtpAuthnService smsAuthnService,
@ -120,7 +120,7 @@ public class AuthnProviderAutoConfiguration {
}
@Bean
public TrustedAuthenticationProvider trustedAuthenticationProvider(
TrustedAuthenticationProvider trustedAuthenticationProvider(
AbstractAuthenticationRealm authenticationRealm,
ApplicationConfig applicationConfig,
SessionManager sessionManager
@ -134,17 +134,17 @@ public class AuthnProviderAutoConfiguration {
}
@Bean
public PasswordPolicyValidator passwordPolicyValidator(JdbcTemplate jdbcTemplate,MessageSource messageSource) {
PasswordPolicyValidator passwordPolicyValidator(JdbcTemplate jdbcTemplate,MessageSource messageSource) {
return new PasswordPolicyValidator(jdbcTemplate,messageSource);
}
@Bean
public LoginRepository loginRepository(JdbcTemplate jdbcTemplate) {
LoginRepository loginRepository(JdbcTemplate jdbcTemplate) {
return new LoginRepository(jdbcTemplate);
}
@Bean
public LoginHistoryRepository loginHistoryRepository(JdbcTemplate jdbcTemplate) {
LoginHistoryRepository loginHistoryRepository(JdbcTemplate jdbcTemplate) {
return new LoginHistoryRepository(jdbcTemplate);
}
@ -153,7 +153,7 @@ public class AuthnProviderAutoConfiguration {
* @return
*/
@Bean
public AbstractRemeberMeManager remeberMeManager(
AbstractRemeberMeManager remeberMeManager(
@Value("${maxkey.server.persistence}") int persistence,
@Value("${maxkey.login.remeberme.validity}") int validity,
ApplicationConfig applicationConfig,

View File

@ -17,8 +17,6 @@
package org.dromara.maxkey.autoconfigure;
import java.io.IOException;
import org.dromara.maxkey.authn.support.socialsignon.service.JdbcSocialsAssociateService;
import org.dromara.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService;
import org.dromara.maxkey.authn.support.socialsignon.token.RedisTokenStore;
@ -42,11 +40,10 @@ public class SocialSignOnAutoConfiguration{
@Bean(name = "socialSignOnProviderService")
@ConditionalOnClass(SocialsProvider.class)
public SocialSignOnProviderService socialSignOnProviderService(
SocialSignOnProviderService socialSignOnProviderService(
@Value("${maxkey.server.persistence}") int persistence,
JdbcTemplate jdbcTemplate,
RedisConnectionFactory redisConnFactory
) throws IOException {
RedisConnectionFactory redisConnFactory) {
SocialSignOnProviderService socialSignOnProviderService = new SocialSignOnProviderService(jdbcTemplate);
//load default Social Providers from database
socialSignOnProviderService.loadSocials("1");
@ -59,7 +56,7 @@ public class SocialSignOnAutoConfiguration{
}
@Bean(name = "socialsAssociateService")
public JdbcSocialsAssociateService socialsAssociateService(
JdbcSocialsAssociateService socialsAssociateService(
JdbcTemplate jdbcTemplate) {
JdbcSocialsAssociateService socialsAssociateService = new JdbcSocialsAssociateService(jdbcTemplate);
_logger.debug("JdbcSocialsAssociateService inited.");

View File

@ -20,7 +20,7 @@ package org.dromara.maxkey.web;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
import jakarta.servlet.http.HttpServletRequest;
@ -34,9 +34,9 @@ import jakarta.servlet.http.HttpServletResponse;
*/
@Controller
public class ExceptionEndpoint {
private static Logger _logger = LoggerFactory.getLogger(ExceptionEndpoint.class);
private static final Logger _logger = LoggerFactory.getLogger(ExceptionEndpoint.class);
@RequestMapping(value = { "/exception/error/400" })
@GetMapping({ "/exception/error/400" })
public ModelAndView error400(
HttpServletRequest request, HttpServletResponse response) {
_logger.debug("Exception BAD_REQUEST");
@ -49,20 +49,20 @@ public class ExceptionEndpoint {
* @param response HttpServletResponse
* @return
*/
@RequestMapping(value = { "/exception/error/404" })
@GetMapping({ "/exception/error/404" })
public ModelAndView error404(
HttpServletRequest request, HttpServletResponse response) {
_logger.debug("Exception PAGE NOT_FOUND ");
return new ModelAndView("exception/404");
}
@RequestMapping(value = { "/exception/error/500" })
@GetMapping({ "/exception/error/500" })
public ModelAndView error500(HttpServletRequest request, HttpServletResponse response) {
_logger.debug("Exception INTERNAL_SERVER_ERROR ");
return new ModelAndView("exception/500");
}
@RequestMapping(value = { "/exception/accessdeny" })
@GetMapping({ "/exception/accessdeny" })
public ModelAndView accessdeny(HttpServletRequest request, HttpServletResponse response) {
_logger.debug("exception/accessdeny ");
return new ModelAndView("exception/accessdeny");

View File

@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.dromara.maxkey.constants.ConstsRoles;
import org.dromara.maxkey.constants.ConstsStatus;
@ -88,7 +88,7 @@ public class LoginRepository {
listUserInfo = findByUsernameOrMobileOrEmail(username,password);
}
_logger.debug("load UserInfo : {}" , listUserInfo);
return (ObjectUtils.isNotEmpty(listUserInfo))? listUserInfo.get(0) : null;
return (CollectionUtils.isNotEmpty(listUserInfo) ? listUserInfo.get(0) : null);
}
public List<UserInfo> findByUsername(String username, String password) {

View File

@ -217,13 +217,13 @@ public class PasswordPolicyValidator {
*/
public void lockUser(UserInfo userInfo) {
try {
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId())) {
if(userInfo.getIsLocked() == ConstsStatus.ACTIVE) {
jdbcTemplate.update(LOCK_USER_UPDATE_STATEMENT,
new Object[] { ConstsStatus.LOCK, new Date(), userInfo.getId() },
new int[] { Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR });
userInfo.setIsLocked(ConstsStatus.LOCK);
}
if (userInfo != null
&& StringUtils.isNotEmpty(userInfo.getId())
&& userInfo.getIsLocked() == ConstsStatus.ACTIVE) {
jdbcTemplate.update(LOCK_USER_UPDATE_STATEMENT,
new Object[] { ConstsStatus.LOCK, new Date(), userInfo.getId() },
new int[] { Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR });
userInfo.setIsLocked(ConstsStatus.LOCK);
}
} catch (Exception e) {
_logger.error("lockUser Exception",e);
@ -297,10 +297,8 @@ public class PasswordPolicyValidator {
}
public void resetBadPasswordCount(UserInfo userInfo) {
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId())) {
if(userInfo.getBadPasswordCount()>0) {
setBadPasswordCount(userInfo.getId(),0);
}
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId()) && userInfo.getBadPasswordCount()>0) {
setBadPasswordCount(userInfo.getId(),0);
}
}

View File

@ -40,6 +40,6 @@ public class InstitutionsService extends JpaService<Institutions>{
public Institutions findByDomain(String domain) {
return getMapper().findByDomain(domain);
};
}
}

View File

@ -244,7 +244,7 @@ public class UserInfoService extends JpaService<UserInfo> {
if(StringUtils.isNotBlank(changePassword.getPassword())) {
String password = passwordEncoder.encode(changePassword.getPassword());
changePassword.setDecipherable(PasswordReciprocal.getInstance().encode(changePassword.getPassword()));
_logger.debug("decipherable : "+changePassword.getDecipherable());
_logger.debug("decipherable : {}",changePassword.getDecipherable());
changePassword.setPassword(password);
changePassword.setPasswordLastSetTime(new Date());
@ -303,10 +303,10 @@ public class UserInfoService extends JpaService<UserInfo> {
*/
public boolean changePassword(ChangePassword changePassword,boolean passwordPolicy) {
try {
_logger.debug("decipherable old : " + changePassword.getDecipherable());
_logger.debug("decipherable new : " + PasswordReciprocal.getInstance().encode(changePassword.getDecipherable()));
_logger.debug("decipherable old : {}" , changePassword.getDecipherable());
_logger.debug("decipherable new : {}" , PasswordReciprocal.getInstance().encode(changePassword.getDecipherable()));
if (passwordPolicy && passwordPolicyValidator.validator(changePassword) == false) {
if (passwordPolicy && !passwordPolicyValidator.validator(changePassword)) {
return false;
}
@ -333,10 +333,7 @@ public class UserInfoService extends JpaService<UserInfo> {
if(changePassworded !=null && StringUtils.isNotBlank(changePassworded.getPassword())) {
UserInfo loadUserInfo = findByUsername(changePassworded.getUsername());
ChangePassword changePassword = new ChangePassword(loadUserInfo);
provisionService.send(
ProvisionTopic.PASSWORD_TOPIC,
changePassword,
ProvisionAct.PASSWORD);
provisionService.send(ProvisionTopic.PASSWORD_TOPIC, changePassword, ProvisionAct.PASSWORD);
}
}

View File

@ -56,7 +56,7 @@ public class AuthorizeBaseEndpoint {
protected Apps getApp(String id){
Apps app=(Apps)WebContext.getAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP);
if(StringUtils.isBlank(id)) {
_logger.error("parameter for app id " + id + " is null.");
_logger.error("parameter for app id {} is null.",id);
}else {
//session中为空或者id不一致重新加载
if(app == null || !app.getId().equalsIgnoreCase(id)) {
@ -65,7 +65,7 @@ public class AuthorizeBaseEndpoint {
WebContext.setAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP, app);
}
if(app == null){
_logger.error("Applications id " + id + " is not exist.");
_logger.error("Applications id {} is not exist.",id);
}
return app;
}

View File

@ -28,13 +28,7 @@ import org.dromara.maxkey.entity.Accounts;
import org.dromara.maxkey.entity.Message;
import org.dromara.maxkey.entity.apps.Apps;
import org.dromara.maxkey.entity.idm.UserInfo;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
/**
* @author Crystal.Sea
@ -44,7 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
@RequestMapping(value = { "/authz/credential" })
public class AuthorizeCredentialEndpoint extends AuthorizeBaseEndpoint{
@RequestMapping("/get/{appId}")
@GetMapping("/get/{appId}")
public Message<Accounts> get(
@PathVariable("appId") String appId,
@CurrentUser UserInfo currentUser){
@ -64,30 +58,30 @@ public class AuthorizeCredentialEndpoint extends AuthorizeBaseEndpoint{
account.setCreateType("manual");
account.setStatus(ConstsStatus.ACTIVE);
}
return new Message<Accounts>(account);
return new Message<>(account);
}
@RequestMapping("/update")
@PutMapping("/update")
public Message<Accounts> update(
@RequestBody Accounts account,
@CurrentUser UserInfo currentUser){
if(StringUtils.isNotEmpty(account.getRelatedPassword())
if(StringUtils.isNotEmpty(account.getRelatedUsername())
&&StringUtils.isNotEmpty(account.getRelatedPassword())){
account.setInstId(currentUser.getInstId());
account.setRelatedPassword(
PasswordReciprocal.getInstance().encode(account.getRelatedPassword()));
if(accountsService.get(account.getId()) == null) {
if(accountsService.insert(account)){
return new Message<Accounts>();
return new Message<>();
}
}else {
if(accountsService.update(account)){
return new Message<Accounts>();
return new Message<>();
}
}
}
return new Message<Accounts>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}

View File

@ -30,8 +30,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.v3.oas.annotations.Operation;
@ -52,13 +52,11 @@ public class AuthorizeEndpoint extends AuthorizeBaseEndpoint{
//all single sign on url
@Operation(summary = "认证总地址接口", description = "参数应用ID分发到不同应用的认证地址",method="GET")
@RequestMapping("/authz/{id}")
public ModelAndView authorize(
HttpServletRequest request,
@PathVariable("id") String id){
ModelAndView modelAndView=null;
Apps app=getApp(id);
@GetMapping("/authz/{id}")
public ModelAndView authorize(HttpServletRequest request,@PathVariable("id") String id){
Apps app = getApp(id);
WebContext.setAttribute(WebConstants.SINGLE_SIGN_ON_APP_ID, app.getId());
ModelAndView modelAndView = WebContext.redirect(app.getLoginUrl());
if(app.getProtocol().equalsIgnoreCase(ConstsProtocols.EXTEND_API)){
modelAndView=WebContext.forward("/authz/api/"+app.getId());
@ -81,13 +79,13 @@ public class AuthorizeEndpoint extends AuthorizeBaseEndpoint{
}else if (app.getProtocol().equalsIgnoreCase(ConstsProtocols.BASIC)){
modelAndView=WebContext.redirect(app.getLoginUrl());
}
_logger.debug(modelAndView.getViewName());
_logger.debug("redirect to view {}",modelAndView.getViewName());
return modelAndView;
}
@RequestMapping("/authz/refused")
@GetMapping("/authz/refused")
public ModelAndView refused(){
ModelAndView modelAndView = new ModelAndView("authorize/authorize_refused");
Apps app = (Apps)WebContext.getAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP);

View File

@ -26,8 +26,8 @@ import org.dromara.maxkey.entity.idm.UserInfo;
import org.dromara.maxkey.web.WebConstants;
import org.dromara.maxkey.web.WebContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import jakarta.servlet.http.HttpServletRequest;
@ -39,27 +39,27 @@ import jakarta.servlet.http.HttpServletRequest;
@Controller
public class AuthorizeProtectedEndpoint{
@RequestMapping("/authz/protected/forward")
@GetMapping("/authz/protected/forward")
public ModelAndView forwardProtectedForward(
HttpServletRequest request ){
String redirect_uri=request.getAttribute("redirect_uri").toString();
String redirectUri=request.getAttribute("redirect_uri").toString();
ModelAndView modelAndView=new ModelAndView("authorize/protected/forward");
modelAndView.addObject("redirect_uri", redirect_uri);
modelAndView.addObject("redirect_uri", redirectUri);
return modelAndView;
}
@RequestMapping("/authz/protected")
@GetMapping("/authz/protected")
public ModelAndView authorizeProtected(
@RequestParam("password") String password,
@RequestParam("redirect_uri") String redirect_uri,
@RequestParam("redirect_uri") String redirectUri,
@CurrentUser UserInfo currentUser){
if( currentUser.getAppLoginPassword().equals(PasswordReciprocal.getInstance().encode(password))){
WebContext.setAttribute(WebConstants.CURRENT_SINGLESIGNON_URI, redirect_uri);
return WebContext.redirect(redirect_uri);
WebContext.setAttribute(WebConstants.CURRENT_SINGLESIGNON_URI, redirectUri);
return WebContext.redirect(redirectUri);
}
ModelAndView modelAndView=new ModelAndView("authorize/protected/forward");
modelAndView.addObject("redirect_uri", redirect_uri);
modelAndView.addObject("redirect_uri", redirectUri);
return modelAndView;
}

View File

@ -57,8 +57,8 @@ public abstract class AbstractAuthorizeAdapter {
KeyStoreLoader keyStoreLoader = WebContext.getBean("keyStoreLoader",KeyStoreLoader.class);
try {
byte[] signData= CertSigner.sign(data.toString().getBytes(), keyStoreLoader.getKeyStore(), keyStoreLoader.getEntityName(), keyStoreLoader.getKeystorePassword());
_logger.debug("signed Token : "+data);
_logger.debug("signature : "+signData.toString());
_logger.debug("signed Token : {}",data);
_logger.debug("signature : {}",signData.toString());
return Base64Utils.base64UrlEncode(data.toString().getBytes("UTF-8"))+"."+Base64Utils.base64UrlEncode(signData);
} catch (UnsupportedEncodingException e) {
@ -79,8 +79,8 @@ public abstract class AbstractAuthorizeAdapter {
public Object encrypt(Object data,String algorithmKey,String algorithm){
algorithmKey = PasswordReciprocal.getInstance().decoder(algorithmKey);
_logger.debug("algorithm : "+algorithm);
_logger.debug("algorithmKey : "+algorithmKey);
_logger.debug("algorithm : {}",algorithm);
_logger.debug("algorithmKey : {}",algorithmKey);
//Chinese , encode data to HEX
try {
data = new String(Hex.encodeHex(data.toString().getBytes("UTF-8")));
@ -89,7 +89,7 @@ public abstract class AbstractAuthorizeAdapter {
}
byte[] encodeData = ReciprocalUtils.encode(data.toString(), algorithmKey, algorithm);
String tokenString = Base64Utils.base64UrlEncode(encodeData);
_logger.trace("Reciprocal then HEX Token : "+tokenString);
_logger.trace("Reciprocal then HEX Token : {}",tokenString);
return tokenString;
}

View File

@ -27,10 +27,10 @@ import org.dromara.maxkey.authz.cas.endpoint.ticket.CasConstants;
import org.dromara.maxkey.authz.cas.endpoint.ticket.Ticket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -42,7 +42,7 @@ import jakarta.servlet.http.HttpServletResponse;
* https://apereo.github.io/cas/6.2.x/protocol/CAS-Protocol-Specification.html
*/
@Tag(name = "2-3-CAS API文档模块")
@Controller
@RestController
public class Cas10AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
static final Logger _logger = LoggerFactory.getLogger(Cas10AuthorizeEndpoint.class);
@ -82,20 +82,14 @@ renew [OPTIONAL] - if this parameter is set, ticket validation will only succeed
<LF>
*/
@Operation(summary = "CAS 1.0 ticket验证接口", description = "通过ticket获取当前登录用户信息",method="POST")
@RequestMapping(CasConstants.ENDPOINT.ENDPOINT_VALIDATE)
@ResponseBody
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_VALIDATE,method={RequestMethod.GET,RequestMethod.POST})
public String validate(
HttpServletRequest request,
HttpServletResponse response,
@RequestParam(value = CasConstants.PARAMETER.TICKET) String ticket,
@RequestParam(value = CasConstants.PARAMETER.SERVICE) String service,
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew
){
_logger.debug("serviceValidate "
+ " ticket " + ticket
+" , service " + service
+" , renew " + renew
);
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew){
_logger.debug("serviceValidate ticket {} , service {} , renew {}" , ticket,service,renew);
Ticket storedTicket = null;
try {
@ -106,7 +100,7 @@ renew [OPTIONAL] - if this parameter is set, ticket validation will only succeed
if(storedTicket != null){
String principal=((SignPrincipal)storedTicket.getAuthentication().getPrincipal()).getUsername();
_logger.debug("principal "+principal);
_logger.debug("principal {}",principal);
return new Service10ResponseBuilder().success()
.setUser(principal)
.serviceResponseBuilder();

View File

@ -39,11 +39,11 @@ import org.dromara.maxkey.web.HttpResponseConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
@ -54,9 +54,8 @@ import jakarta.servlet.http.HttpServletResponse;
* https://apereo.github.io/cas/6.2.x/protocol/CAS-Protocol-V2-Specification.html
*/
@Tag(name = "2-3-CAS API文档模块")
@Controller
@RestController
public class Cas20AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
static final Logger _logger = LoggerFactory.getLogger(Cas20AuthorizeEndpoint.class);
/**
@ -176,7 +175,6 @@ For all error codes, it is RECOMMENDED that CAS provide a more detailed message
*/
@Operation(summary = "CAS 2.0 ticket验证接口", description = "通过ticket获取当前登录用户信息",method="POST")
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_SERVICE_VALIDATE,produces =MediaType.APPLICATION_XML_VALUE,method={RequestMethod.GET,RequestMethod.POST})
@ResponseBody
public String serviceValidate(
HttpServletRequest request,
HttpServletResponse response,
@ -185,13 +183,7 @@ For all error codes, it is RECOMMENDED that CAS provide a more detailed message
@RequestParam(value = CasConstants.PARAMETER.PROXY_CALLBACK_URL,required=false) String pgtUrl,
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("serviceValidate "
+ " ticket " + ticket
+" , service " + service
+" , pgtUrl " + pgtUrl
+" , renew " + renew
+" , format " + format
);
_logger.debug("serviceValidate ticket {} , service {} , pgtUrl {} , renew {} , format {}" , ticket,service,pgtUrl,renew,format);
Ticket storedTicket=null;
if(ticket.startsWith(CasConstants.PREFIX.SERVICE_TICKET_PREFIX)) {
@ -303,8 +295,8 @@ Response on ticket validation failure:
*/
@Operation(summary = "CAS 2.0 ticket代理验证接口", description = "通过ticket获取当前登录用户信息",method="POST")
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_PROXY_VALIDATE,produces =MediaType.APPLICATION_XML_VALUE)
@ResponseBody
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_PROXY_VALIDATE,produces =MediaType.APPLICATION_XML_VALUE,method={RequestMethod.GET,RequestMethod.POST})
public String proxy(
HttpServletRequest request,
HttpServletResponse response,
@ -313,13 +305,7 @@ Response on ticket validation failure:
@RequestParam(value = CasConstants.PARAMETER.PROXY_CALLBACK_URL,required=false) String pgtUrl,
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("proxyValidate "
+ " ticket " + ticket
+" , service " + service
+" , pgtUrl " + pgtUrl
+" , renew " + renew
+" , format " + format
);
_logger.debug("proxyValidate ticket {} , service {} , pgtUrl {} , renew {} , format {}" ,ticket,service, pgtUrl,renew,format);
Ticket storedTicket=null;
if(ticket.startsWith(CasConstants.PREFIX.PROXY_TICKET_PREFIX)) {
@ -408,25 +394,21 @@ INTERNAL_ERROR - an internal error occurred during ticket validation
For all error codes, it is RECOMMENDED that CAS provide a more detailed message as the body of the <cas:authenticationFailure> block of the XML response.
*/
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_PROXY ,produces =MediaType.APPLICATION_XML_VALUE)
@ResponseBody
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_PROXY ,produces =MediaType.APPLICATION_XML_VALUE,method={RequestMethod.GET,RequestMethod.POST})
public String proxy(
HttpServletRequest request,
HttpServletResponse response,
@RequestParam(value = CasConstants.PARAMETER.PROXY_GRANTING_TICKET) String pgt,
@RequestParam(value = CasConstants.PARAMETER.TARGET_SERVICE) String targetService,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("proxy "
+ " pgt " + pgt
+" , targetService " + targetService
+" , format " + format
);
_logger.debug("proxy pgt {} , targetService {} , format {}" ,pgt,targetService, format);
ProxyServiceResponseBuilder proxyServiceResponseBuilder=new ProxyServiceResponseBuilder(format);
ProxyGrantingTicketImpl proxyGrantingTicketImpl = (ProxyGrantingTicketImpl)casProxyGrantingTicketServices.get(pgt);
if(proxyGrantingTicketImpl != null) {
ProxyTicketImpl ProxyTicketImpl = new ProxyTicketImpl(proxyGrantingTicketImpl.getAuthentication(),proxyGrantingTicketImpl.getCasDetails());
String proxyTicket =ticketServices.createTicket(ProxyTicketImpl);
ProxyTicketImpl proxyTicketImpl = new ProxyTicketImpl(proxyGrantingTicketImpl.getAuthentication(),proxyGrantingTicketImpl.getCasDetails());
String proxyTicket =ticketServices.createTicket(proxyTicketImpl);
proxyServiceResponseBuilder.success().setTicket(proxyTicket).setFormat(format);
}else {
proxyServiceResponseBuilder.success().setTicket("").setFormat(format);

View File

@ -67,13 +67,7 @@ public class Cas30AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
@RequestParam(value = CasConstants.PARAMETER.PROXY_CALLBACK_URL,required=false) String pgtUrl,
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("serviceValidate "
+ " ticket " + ticket
+" , service " + service
+" , pgtUrl " + pgtUrl
+" , renew " + renew
+" , format " + format
);
_logger.debug("serviceValidate ticket {} , service {} , pgtUrl {} , renew {} , format {}", ticket,service,pgtUrl,renew,format);
Ticket storedTicket=null;
if(ticket.startsWith(CasConstants.PREFIX.SERVICE_TICKET_PREFIX)) {
@ -123,23 +117,19 @@ public class Cas30AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
}
@Operation(summary = "CAS 3.0 ProxyTicket代理验证接口", description = "通过ProxyGrantingTicket获取ProxyTicket",method="POST")
@RequestMapping(CasConstants.ENDPOINT.ENDPOINT_PROXY_V3)
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_PROXY_V3,method={RequestMethod.GET,RequestMethod.POST})
public void proxy(
HttpServletRequest request,
HttpServletResponse response,
@RequestParam(value = CasConstants.PARAMETER.PROXY_GRANTING_TICKET) String pgt,
@RequestParam(value = CasConstants.PARAMETER.TARGET_SERVICE) String targetService,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("proxy "
+ " pgt " + pgt
+" , targetService " + targetService
+" , format " + format
);
_logger.debug("proxy pgt {} , targetService {} , format {}" , pgt,targetService,format);
ProxyServiceResponseBuilder proxyServiceResponseBuilder=new ProxyServiceResponseBuilder(format);
ProxyGrantingTicketImpl proxyGrantingTicketImpl = (ProxyGrantingTicketImpl)casProxyGrantingTicketServices.get(pgt);
if(proxyGrantingTicketImpl != null) {
ProxyTicketImpl ProxyTicketImpl = new ProxyTicketImpl(proxyGrantingTicketImpl.getAuthentication(),proxyGrantingTicketImpl.getCasDetails());
String proxyTicket =ticketServices.createTicket(ProxyTicketImpl);
ProxyTicketImpl proxyTicketImpl = new ProxyTicketImpl(proxyGrantingTicketImpl.getAuthentication(),proxyGrantingTicketImpl.getCasDetails());
String proxyTicket =ticketServices.createTicket(proxyTicketImpl);
proxyServiceResponseBuilder.success().setTicket(proxyTicket).setFormat(format);
}else {
proxyServiceResponseBuilder.success().setTicket("").setFormat(format);
@ -149,7 +139,7 @@ public class Cas30AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
}
@Operation(summary = "CAS 3.0 ticket代理验证接口", description = "通过ProxyTicket获取当前登录用户信息",method="POST")
@RequestMapping(CasConstants.ENDPOINT.ENDPOINT_PROXY_VALIDATE_V3)
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_PROXY_VALIDATE_V3,method={RequestMethod.GET,RequestMethod.POST})
public void proxy(
HttpServletRequest request,
HttpServletResponse response,
@ -158,13 +148,7 @@ public class Cas30AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
@RequestParam(value = CasConstants.PARAMETER.PROXY_CALLBACK_URL,required=false) String pgtUrl,
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("proxyValidate "
+ " ticket " + ticket
+" , service " + service
+" , pgtUrl " + pgtUrl
+" , renew " + renew
+" , format " + format
);
_logger.debug("proxyValidate ticket {} , service {} , pgtUrl {} , renew {} , format {}" , ticket,service,pgtUrl,renew,format);
Ticket storedTicket=null;
if(ticket.startsWith(CasConstants.PREFIX.PROXY_TICKET_PREFIX)) {

View File

@ -22,8 +22,8 @@ package org.dromara.maxkey.authz.cas.endpoint;
import java.security.Principal;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
import org.dromara.maxkey.authn.session.Session;
import org.dromara.maxkey.authn.web.AuthorizationUtils;
import org.dromara.maxkey.authz.cas.endpoint.ticket.CasConstants;
@ -37,7 +37,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@ -113,7 +112,7 @@ public class CasAuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
}
@RequestMapping(CasConstants.ENDPOINT.ENDPOINT_SERVICE_TICKET_GRANTING)
@GetMapping(CasConstants.ENDPOINT.ENDPOINT_SERVICE_TICKET_GRANTING)
public ModelAndView grantingTicket( Principal principal,
HttpServletRequest request,
HttpServletResponse response){
@ -148,8 +147,8 @@ public class CasAuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
Map <String, String> parameterMap = (Map <String, String>)WebContext.getAttribute(CasConstants.PARAMETER.PARAMETER_MAP);
parameterMap.remove(CasConstants.PARAMETER.TICKET);
parameterMap.remove(CasConstants.PARAMETER.SERVICE);
for (String key : parameterMap.keySet()) {
callbackUrl.append("&").append(key).append("=").append(parameterMap.get(key));
for (Entry<String, String> entry : parameterMap.entrySet()) {
callbackUrl.append("&").append(entry.getKey()).append("=").append(entry.getValue());
}
}

View File

@ -27,7 +27,7 @@ import org.dromara.maxkey.web.WebContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@ -54,7 +54,7 @@ public class CasLogoutEndpoint extends CasBaseAuthorizeEndpoint{
* @return
*/
@Operation(summary = "CAS注销接口", description = "CAS注销接口",method="GET")
@RequestMapping(CasConstants.ENDPOINT.ENDPOINT_LOGOUT)
@GetMapping(CasConstants.ENDPOINT.ENDPOINT_LOGOUT)
public ModelAndView logout(HttpServletRequest request , HttpServletResponse response,
@RequestParam(value = CasConstants.PARAMETER.SERVICE , required = false) String casService){
StringBuffer logoutUrl = new StringBuffer("/force/logout");

View File

@ -29,7 +29,6 @@ import org.dromara.maxkey.authn.web.AuthorizationUtils;
import org.dromara.maxkey.authz.endpoint.AuthorizeBaseEndpoint;
import org.dromara.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter;
import org.dromara.maxkey.authz.jwt.endpoint.adapter.JwtAdapter;
import org.dromara.maxkey.configuration.ApplicationConfig;
import org.dromara.maxkey.constants.ConstsBoolean;
import org.dromara.maxkey.constants.ContentType;
import org.dromara.maxkey.crypto.jose.keystore.JWKSetKeyStore;
@ -67,9 +66,6 @@ public class JwtAuthorizeEndpoint extends AuthorizeBaseEndpoint{
@Autowired
AppsJwtDetailsService jwtDetailsService;
@Autowired
ApplicationConfig applicationConfig;
@Operation(summary = "JWT应用ID认证接口", description = "应用ID")
@GetMapping("/authz/jwt/{id}")
public ModelAndView authorize(
@ -80,7 +76,7 @@ public class JwtAuthorizeEndpoint extends AuthorizeBaseEndpoint{
ModelAndView modelAndView=new ModelAndView();
Apps application = getApp(id);
AppsJwtDetails jwtDetails = jwtDetailsService.getAppDetails(application.getId() , true);
_logger.debug(""+jwtDetails);
_logger.debug("jwtDetails {}",jwtDetails);
jwtDetails.setAdapter(application.getAdapter());
jwtDetails.setIsAdapter(application.getIsAdapter());
@ -94,8 +90,7 @@ public class JwtAuthorizeEndpoint extends AuthorizeBaseEndpoint{
}
adapter = (AbstractAuthorizeAdapter)jwtAdapter;
}else{
JwtAdapter jwtAdapter =new JwtAdapter(jwtDetails);
adapter = (AbstractAuthorizeAdapter)jwtAdapter;
adapter =new JwtAdapter(jwtDetails);
}
adapter.setPrincipal(AuthorizationUtils.getPrincipal());

View File

@ -41,9 +41,10 @@ import org.dromara.maxkey.authz.oauth2.provider.token.AccessTokenConverter;
import org.dromara.maxkey.authz.oauth2.provider.token.DefaultAccessTokenConverter;
import org.dromara.maxkey.authz.oauth2.provider.token.ResourceServerTokenServices;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -55,7 +56,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
* @author Joel D'sa
*/
@Tag(name = "2-1-OAuth v2.0 API文档模块")
@Controller
@RestController
public class CheckTokenEndpoint {
private ResourceServerTokenServices resourceServerTokenServices;
@ -79,8 +80,7 @@ public class CheckTokenEndpoint {
}
@Operation(summary = "OAuth 2.0 token检查接口", description = "传递参数token",method="POST")
@RequestMapping(value = OAuth2Constants.ENDPOINT.ENDPOINT_CHECK_TOKEN)
@ResponseBody
@PostMapping(OAuth2Constants.ENDPOINT.ENDPOINT_CHECK_TOKEN)
public Map<String, ?> checkToken(@RequestParam(OAuth2Constants.PARAMETER.TOKEN) String value) {
OAuth2AccessToken token = resourceServerTokenServices.readAccessToken(value);

View File

@ -66,9 +66,9 @@ public class AssertionEndpoint {
logger.debug("saml20 assertion start.");
bindingAdapter = (BindingAdapter) request.getSession().getAttribute(
WebConstants.AUTHORIZE_SIGN_ON_APP_SAMLV20_ADAPTER);
logger.debug("saml20 assertion get session samlv20Adapter "+bindingAdapter);
logger.debug("saml20 assertion get session samlv20Adapter {}",bindingAdapter);
AppsSAML20Details saml20Details = bindingAdapter.getSaml20Details();
logger.debug("saml20Details "+saml20Details.getExtendAttr());
logger.debug("saml20Details {}",saml20Details.getExtendAttr());
AuthnRequestInfo authnRequestInfo = bindingAdapter.getAuthnRequestInfo();
if (authnRequestInfo == null) {
@ -77,9 +77,8 @@ public class AssertionEndpoint {
}
logger.debug("AuthnRequestInfo: {}", authnRequestInfo);
HashMap <String,String>attributeMap=new HashMap<String,String>();
attributeMap.put(WebConstants.ONLINE_TICKET_NAME,
AuthorizationUtils.getPrincipal().getSessionId());
HashMap <String,String>attributeMap=new HashMap<>();
attributeMap.put(WebConstants.ONLINE_TICKET_NAME, AuthorizationUtils.getPrincipal().getSessionId());
//saml20Details
Response authResponse = authnResponseGenerator.generateAuthnResponse(

View File

@ -123,7 +123,7 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
@Bean(name = "jaxb2Marshaller")
Jaxb2Marshaller jaxb2Marshaller() {
Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
jaxb2Marshaller.setClassesToBeBound(org.dromara.maxkey.entity.xml.UserInfoXML.class);;
jaxb2Marshaller.setClassesToBeBound(org.dromara.maxkey.entity.xml.UserInfoXML.class);
return jaxb2Marshaller;
}

View File

@ -17,6 +17,8 @@
package org.dromara.maxkey.autoconfigure;
import java.time.Duration;
import org.dromara.maxkey.persistence.redis.RedisConnectionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -70,7 +72,7 @@ public class RedisAutoConfiguration {
poolConfig.setMaxIdle(maxIdle);
poolConfig.setMinIdle(minIdle);
poolConfig.setMaxTotal(maxActive);
poolConfig.setMaxWaitMillis(maxWait);
poolConfig.setMaxWait(Duration.ofMillis(maxWait));
factory.setPoolConfig(poolConfig);

View File

@ -99,7 +99,7 @@ public class JdbcOrganizationService extends AbstractSynchronizerService impleme
try {
setFieldValue(org,field,value);
} catch (Exception e) {
_logger.error("setProperty {}", e);
_logger.error("setProperty Exception", e);
}
}
}
@ -143,7 +143,7 @@ public class JdbcOrganizationService extends AbstractSynchronizerService impleme
try {
PropertyUtils.setSimpleProperty(org, mapper.getField(), value);
} catch (Exception e) {
_logger.error("setSimpleProperty {}", e);
_logger.error("setSimpleProperty Exception", e);
}
}
}

View File

@ -47,8 +47,9 @@ import static org.dromara.maxkey.synchronizer.utils.FieldUtil.setFieldValue;
@Service
public class JdbcUsersService extends AbstractSynchronizerService implements ISynchronizerService {
final static Logger _logger = LoggerFactory.getLogger(JdbcUsersService.class);
@Autowired
static final Logger _logger = LoggerFactory.getLogger(JdbcUsersService.class);
@Autowired
public SyncJobConfigFieldService syncJobConfigFieldService;
private static final Integer USER_TYPE = 1;
@ -122,7 +123,7 @@ public class JdbcUsersService extends AbstractSynchronizerService implements ISy
try {
PropertyUtils.setSimpleProperty(user, mapper.getField(), value);
} catch (Exception e) {
_logger.error("setSimpleProperty {}", e);
_logger.error("setSimpleProperty ", e);
}
}
}

View File

@ -50,8 +50,8 @@ public class FieldUtil {
}
if (fieldType == Integer.class || fieldType == int.class) {
if (value instanceof Boolean) {
return (Boolean) value ? 1 : 0;
if (value instanceof Boolean iValue) {
return Boolean.TRUE.equals(iValue) ? 1 : 0;
}
return Integer.parseInt(value.toString());
} else if (fieldType == Long.class || fieldType == long.class) {
@ -65,10 +65,10 @@ public class FieldUtil {
} else if (fieldType == DateTime.class) {
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
DateTime dateTime;
if (value instanceof Long) {
dateTime = new DateTime((Long) value);
} else if (value instanceof String) {
dateTime = DateTime.parse((String) value);
if (value instanceof Long iValue) {
dateTime = new DateTime(iValue);
} else if (value instanceof String iValue) {
dateTime = DateTime.parse(iValue);
}else {
dateTime = new DateTime(value);
}

View File

@ -1,6 +1,6 @@
{
"name": "maxkey",
"version": "3.5.0",
"version": "4.1.x",
"description": "Leading-Edge IAM Identity and Access Management",
"author": "MaxKey <support@maxsso.net>",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "maxkey",
"version": "3.5.0",
"version": "4.1.x",
"description": "Leading-Edge IAM Identity and Access Management",
"author": "MaxKey <support@maxsso.net>",
"repository": {

View File

@ -47,9 +47,9 @@ export class GroupEditerComponent implements OnInit {
submitting: boolean;
model: Groups;
} = {
submitting: false,
model: new Groups()
};
submitting: false,
model: new Groups()
};
// TreeNodes
treeNodes = new TreeNodes(false);
@ -66,7 +66,7 @@ export class GroupEditerComponent implements OnInit {
private msg: NzMessageService,
@Inject(ALAIN_I18N_TOKEN) private i18n: I18NService,
private cdr: ChangeDetectorRef
) { }
) {}
ngOnInit(): void {
this.tree();

View File

@ -17,7 +17,7 @@
package org.dromara.maxkey.gateway.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
@ -25,7 +25,7 @@ import java.util.Map;
@RestController
public class FallbackController {
@RequestMapping("/defaultFallback")
@GetMapping("/defaultFallback")
public Map<String , Object> defaultFallback() {
Map<String , Object> map = new HashMap<>();
map.put("code", 1);

View File

@ -35,11 +35,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/**
* AppListController.
@ -47,7 +47,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
* @author Administrator
*
*/
@Controller
@RestController
public class AppListController {
static final Logger logger = LoggerFactory.getLogger(AppListController.class);
@ -65,8 +65,7 @@ public class AppListController {
* @param gridList 类型
* @return
*/
@RequestMapping(value = { "/appList" }, produces = {MediaType.APPLICATION_JSON_VALUE})
@ResponseBody
@GetMapping(value = { "/appList" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<List<UserApps>> appList(
@RequestParam(value = "gridList", required = false) String gridList,
@CurrentUser UserInfo currentUser) {
@ -78,13 +77,11 @@ public class AppListController {
for (UserApps app : appList) {
app.transIconBase64();
}
//AuthorizationUtils.setAuthentication(null);
return new Message<List<UserApps>>(appList);
return new Message<>(appList);
}
@RequestMapping(value = { "/account/get" })
@ResponseBody
@GetMapping(value = { "/account/get" })
public Message<Accounts> getAccount(
@RequestParam("credential") String credential,
@RequestParam("appId") String appId,
@ -107,8 +104,7 @@ public class AppListController {
}
@RequestMapping(value = { "/account/update" })
@ResponseBody
@PutMapping(value = { "/account/update" })
public Message<Accounts> updateAccount(
@RequestParam("credential") String credential,
@ModelAttribute Accounts account,

View File

@ -40,13 +40,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
@Controller
@RestController
@RequestMapping(value = { "/forgotpassword" })
public class ForgotPasswordContorller {
private static Logger logger = LoggerFactory.getLogger(ForgotPasswordContorller.class);
@ -89,17 +85,15 @@ public class ForgotPasswordContorller {
@Autowired
CnfPasswordPolicyService passwordPolicyService;
@RequestMapping(value={"/passwordpolicy"}, produces = {MediaType.APPLICATION_JSON_VALUE})
@GetMapping(value={"/passwordpolicy"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<CnfPasswordPolicy> passwordpolicy(){
CnfPasswordPolicy passwordPolicy = passwordPolicyService.get(WebContext.getInst().getId());
//构建密码强度说明
passwordPolicy.buildMessage();
return new Message<CnfPasswordPolicy>(passwordPolicy);
return new Message<>(passwordPolicy);
}
@ResponseBody
@RequestMapping(value = { "/validateCaptcha" }, produces = {MediaType.APPLICATION_JSON_VALUE})
@GetMapping(value = { "/validateCaptcha" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<ChangePassword> validateCaptcha(
@RequestParam String userId,
@RequestParam String state,
@ -111,16 +105,14 @@ public class ForgotPasswordContorller {
if(userInfo != null) {
AbstractOtpAuthn smsOtpAuthn = smsOtpAuthnService.getByInstId(userInfo.getInstId());
if (otpCaptcha == null || !smsOtpAuthn.validate(userInfo, otpCaptcha)) {
return new Message<ChangePassword>(Message.FAIL);
return new Message<>(Message.FAIL);
}
return new Message<ChangePassword>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
}
return new Message<ChangePassword>(Message.FAIL);
return new Message<>(Message.FAIL);
}
@ResponseBody
@RequestMapping(value = { "/produceOtp" }, produces = {MediaType.APPLICATION_JSON_VALUE})
@GetMapping(value = { "/produceOtp" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<ChangePassword> produceOtp(
@RequestParam String mobile,
@RequestParam String state,
@ -129,7 +121,7 @@ public class ForgotPasswordContorller {
logger.debug(" Mobile {}: " ,mobile);
if (!authTokenService.validateCaptcha(state,captcha)) {
logger.debug("login captcha valid error.");
return new Message<ChangePassword>(Message.FAIL);
return new Message<>(Message.FAIL);
}
ChangePassword change = null;
@ -141,15 +133,14 @@ public class ForgotPasswordContorller {
change.clearPassword();
AbstractOtpAuthn smsOtpAuthn = smsOtpAuthnService.getByInstId(userInfo.getInstId());
smsOtpAuthn.produce(userInfo);
return new Message<ChangePassword>(change);
return new Message<>(change);
}
}
return new Message<ChangePassword>(Message.FAIL);
return new Message<>(Message.FAIL);
}
@ResponseBody
@RequestMapping(value = { "/produceEmailOtp" }, produces = {MediaType.APPLICATION_JSON_VALUE})
@GetMapping(value = { "/produceEmailOtp" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<ChangePassword> produceEmailOtp(
@RequestParam String email,
@RequestParam String state,
@ -157,7 +148,7 @@ public class ForgotPasswordContorller {
logger.debug("/forgotpassword/produceEmailOtp Email {} : " , email);
if (!authTokenService.validateCaptcha(state,captcha)) {
logger.debug("captcha valid error.");
return new Message<ChangePassword>(Message.FAIL);
return new Message<>(Message.FAIL);
}
ChangePassword change = null;
@ -168,13 +159,13 @@ public class ForgotPasswordContorller {
change.clearPassword();
AbstractOtpAuthn mailOtpAuthn = mailOtpAuthnService.getMailOtpAuthn(userInfo.getInstId());
mailOtpAuthn.produce(userInfo);
return new Message<ChangePassword>(change);
return new Message<>(change);
}
}
return new Message<ChangePassword>(Message.FAIL);
return new Message<>(Message.FAIL);
}
@RequestMapping(value = { "/setpassword" })
@GetMapping({ "/setpassword" })
public Message<ChangePassword> setPassWord(
@ModelAttribute ChangePassword changePassword,
@RequestParam String forgotType,
@ -204,15 +195,15 @@ public class ForgotPasswordContorller {
ConstsAct.FORGOT_PASSWORD,
ConstsActResult.SUCCESS,
loadedUserInfo);
return new Message<ChangePassword>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
}else {
return new Message<ChangePassword>(Message.FAIL);
return new Message<>(Message.FAIL);
}
} else {
return new Message<ChangePassword>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
}
return new Message<ChangePassword>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}

View File

@ -295,7 +295,7 @@ springdoc.group-configs[0].paths-to-match =/*
springdoc.group-configs[0].packages-to-scan =org.dromara.maxkey
knife4j.enable =true
knife4j.setting.language =zh_cn
knife4j.setting.language =ZH_CN
knife4j.setting.swagger-model-name =\u5B9E\u4F53\u7C7B\u5217\u8868
############################################################################

View File

@ -32,11 +32,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@ -50,9 +52,8 @@ public class AccessController {
@Autowired
HistorySystemLogsService systemLog;
@RequestMapping(value = { "/appsInGroup" })
@ResponseBody
public Message<?> appsInRole(
@GetMapping(value = { "/appsInGroup" })
public Message<JpaPageResults<Access>> appsInRole(
@ModelAttribute Access groupPermission,
@CurrentUser UserInfo currentUser) {
JpaPageResults<Access> groupPermissions;
@ -64,12 +65,11 @@ public class AccessController {
app.transIconBase64();
}
}
return new Message<JpaPageResults<Access>>(Message.FAIL,groupPermissions);
return new Message<>(Message.FAIL,groupPermissions);
}
@RequestMapping(value = { "/appsNotInGroup" })
@ResponseBody
public Message<?> appsNotInRole(
@GetMapping(value = { "/appsNotInGroup" })
public Message<JpaPageResults<Access>> appsNotInRole(
@ModelAttribute Access groupPermission,
@CurrentUser UserInfo currentUser) {
JpaPageResults<Access> groupPermissions;
@ -81,16 +81,15 @@ public class AccessController {
app.transIconBase64();
}
}
return new Message<JpaPageResults<Access>>(Message.FAIL,groupPermissions);
return new Message<>(Message.FAIL,groupPermissions);
}
@RequestMapping(value = {"/add"})
@ResponseBody
public Message<?> insertPermission(
@PostMapping(value = {"/add"})
public Message<Access> insertPermission(
@RequestBody Access groupPermission,
@CurrentUser UserInfo currentUser) {
if (groupPermission == null || groupPermission.getGroupId() == null) {
return new Message<Access>(Message.FAIL);
return new Message<>(Message.FAIL);
}
String roleId = groupPermission.getGroupId();
@ -107,20 +106,19 @@ public class AccessController {
}
}
if(result) {
return new Message<Access>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
}
}
return new Message<Access>(Message.FAIL);
return new Message<>(Message.FAIL);
}
@ResponseBody
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Access> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
logger.debug("-delete ids : {}" , ids);
if (accessService.deleteBatch(ids)) {
return new Message<Access>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Access>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}

View File

@ -20,6 +20,7 @@ package org.dromara.maxkey.web.apps.contorller;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import org.dromara.maxkey.authn.annotation.CurrentUser;
import org.dromara.maxkey.constants.ConstsProtocols;
import org.dromara.maxkey.crypto.ReciprocalUtils;
@ -30,14 +31,7 @@ import org.dromara.mybatis.jpa.entity.JpaPageResults;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWEAlgorithm;
import com.nimbusds.jose.JWSAlgorithm;
@ -54,19 +48,18 @@ import com.nimbusds.jose.jwk.gen.RSAKeyGenerator;
public class ApplicationsController extends BaseAppContorller {
static final Logger logger = LoggerFactory.getLogger(ApplicationsController.class);
@RequestMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> init() {
@GetMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Apps> init() {
Apps app=new Apps();
app.setId(app.generateId());
app.setProtocol(ConstsProtocols.BASIC);
app.setSecret(ReciprocalUtils.generateKey(""));
return new Message<Apps>(app);
return new Message<>(app);
}
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
@ResponseBody
public Message<?> fetch(@ModelAttribute Apps apps,@CurrentUser UserInfo currentUser) {
@GetMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<JpaPageResults<Apps>> fetch(@ModelAttribute Apps apps,@CurrentUser UserInfo currentUser) {
apps.setInstId(currentUser.getInstId());
JpaPageResults<Apps> appsList =appsService.fetchPageResults(apps);
for (Apps app : appsList.getRows()){
@ -75,80 +68,73 @@ public class ApplicationsController extends BaseAppContorller {
app.setSharedPassword(null);
}
logger.debug("List {}" , appsList);
return new Message<JpaPageResults<Apps>>(appsList);
return new Message<>(appsList);
}
@ResponseBody
@RequestMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> query(@ModelAttribute Apps apps,@CurrentUser UserInfo currentUser) {
@GetMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Apps> query(@ModelAttribute Apps apps,@CurrentUser UserInfo currentUser) {
logger.debug("-query : {}" , apps);
if (appsService.query(apps)!=null) {
return new Message<Apps>(Message.SUCCESS);
if (CollectionUtils.isNotEmpty(appsService.query(apps))) {
return new Message<>(Message.SUCCESS);
} else {
return new Message<Apps>(Message.SUCCESS);
return new Message<>(Message.FAIL);
}
}
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> get(@PathVariable("id") String id) {
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Apps> get(@PathVariable("id") String id) {
Apps apps = appsService.get(id);
decoderSecret(apps);
apps.transIconBase64();
return new Message<Apps>(apps);
return new Message<>(apps);
}
@ResponseBody
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> insert(@RequestBody Apps apps,@CurrentUser UserInfo currentUser) {
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Apps> insert(@RequestBody Apps apps,@CurrentUser UserInfo currentUser) {
logger.debug("-Add : {}" , apps);
transform(apps);
apps.setInstId(currentUser.getInstId());
if (appsService.insert(apps)) {
return new Message<Apps>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Apps>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> update(@RequestBody Apps apps,@CurrentUser UserInfo currentUser) {
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Apps> update(@RequestBody Apps apps,@CurrentUser UserInfo currentUser) {
logger.debug("-update : {}" , apps);
transform(apps);
apps.setInstId(currentUser.getInstId());
if (appsService.update(apps)) {
return new Message<Apps>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Apps>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Apps> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
logger.debug("-delete ids : {} " , ids);
if (appsService.deleteBatch(ids)) {
return new Message<Apps>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Apps>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value = { "/updateExtendAttr" })
public Message<?> updateExtendAttr(@RequestBody Apps app) {
@PostMapping({ "/updateExtendAttr" })
public Message<Apps> updateExtendAttr(@RequestBody Apps app) {
logger.debug("-updateExtendAttr id : {} , ExtendAttr : {}" , app.getId(),app.getExtendAttr());
if (appsService.updateExtendAttr(app)) {
return new Message<Apps>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Apps>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value = { "/generate/secret/{type}" })
public Message<?> generateSecret(@PathVariable("type") String type,@RequestParam(name="id",required=false) String id) throws JOSEException {
@GetMapping({ "/generate/secret/{type}" })
public Message<String> generateSecret(@PathVariable("type") String type,@RequestParam(name="id",required=false) String id) throws JOSEException {
String secret="";
type=type.toLowerCase();
if(type.equals("des")){
@ -203,7 +189,7 @@ public class ApplicationsController extends BaseAppContorller {
secret=ReciprocalUtils.generateKey("");
}
return new Message<Object>(Message.SUCCESS,(Object)secret);
return new Message<>(Message.SUCCESS,secret);
}

View File

@ -30,12 +30,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@ -46,57 +41,54 @@ public class CasDetailsController extends BaseAppContorller {
@Autowired
AppsCasDetailsService casDetailsService;
@RequestMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> init() {
@GetMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsCasDetails> init() {
AppsCasDetails casDetails =new AppsCasDetails();
casDetails.setId(casDetails.generateId());
casDetails.setProtocol(ConstsProtocols.CAS);
casDetails.setSecret(ReciprocalUtils.generateKey(""));
return new Message<AppsCasDetails>(casDetails);
return new Message<>(casDetails);
}
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> get(@PathVariable("id") String id) {
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsCasDetails> get(@PathVariable("id") String id) {
AppsCasDetails casDetails=casDetailsService.getAppDetails(id , false);
super.decoderSecret(casDetails);
casDetails.transIconBase64();
return new Message<AppsCasDetails>(casDetails);
return new Message<>(casDetails);
}
@ResponseBody
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> insert(@RequestBody AppsCasDetails casDetails,@CurrentUser UserInfo currentUser) {
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsCasDetails> insert(@RequestBody AppsCasDetails casDetails,@CurrentUser UserInfo currentUser) {
logger.debug("-Add : {}" , casDetails);
transform(casDetails);
casDetails.setInstId(currentUser.getInstId());
if (casDetailsService.insert(casDetails)&&appsService.insertApp(casDetails)) {
return new Message<AppsCasDetails>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AppsCasDetails>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> update(@RequestBody AppsCasDetails casDetails,@CurrentUser UserInfo currentUser) {
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsCasDetails> update(@RequestBody AppsCasDetails casDetails,@CurrentUser UserInfo currentUser) {
logger.debug("-update : {}" , casDetails);
transform(casDetails);
casDetails.setInstId(currentUser.getInstId());
if (casDetailsService.update(casDetails)&&appsService.updateApp(casDetails)) {
return new Message<AppsCasDetails>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AppsCasDetails>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsCasDetails> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
logger.debug("-delete ids : {} " , ids);
if (casDetailsService.deleteBatch(ids)&&appsService.deleteBatch(ids)) {
return new Message<AppsCasDetails>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AppsCasDetails>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}

View File

@ -30,12 +30,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@ -43,66 +38,61 @@ import org.springframework.web.bind.annotation.RestController;
public class ExtendApiDetailsController extends BaseAppContorller {
static final Logger logger = LoggerFactory.getLogger(ExtendApiDetailsController.class);
@RequestMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> init() {
@GetMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsExtendApiDetails> init() {
AppsExtendApiDetails extendApiDetails=new AppsExtendApiDetails();
extendApiDetails.setId(extendApiDetails.generateId());
extendApiDetails.setProtocol(ConstsProtocols.EXTEND_API);
extendApiDetails.setSecret(ReciprocalUtils.generateKey(""));
return new Message<AppsExtendApiDetails>(extendApiDetails);
return new Message<>(extendApiDetails);
}
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> get(@PathVariable("id") String id) {
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsExtendApiDetails> get(@PathVariable("id") String id) {
Apps application= appsService.get(id);
super.decoderSecret(application);
AppsExtendApiDetails extendApiDetails=new AppsExtendApiDetails();
BeanUtils.copyProperties(application, extendApiDetails);
extendApiDetails.transIconBase64();
return new Message<AppsExtendApiDetails>(extendApiDetails);
return new Message<>(extendApiDetails);
}
@ResponseBody
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> add(
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsExtendApiDetails> add(
@RequestBody AppsExtendApiDetails extendApiDetails,
@CurrentUser UserInfo currentUser) {
logger.debug("-Add :" + extendApiDetails);
logger.debug("-Add : {}" , extendApiDetails);
transform(extendApiDetails);
extendApiDetails.setInstId(currentUser.getInstId());
if (appsService.insertApp(extendApiDetails)) {
return new Message<AppsExtendApiDetails>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AppsExtendApiDetails>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> update(
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsExtendApiDetails> update(
@RequestBody AppsExtendApiDetails extendApiDetails,
@CurrentUser UserInfo currentUser) {
logger.debug("-update :" + extendApiDetails);
logger.debug("-update : {}" , extendApiDetails);
transform(extendApiDetails);
extendApiDetails.setInstId(currentUser.getInstId());
if (appsService.updateApp(extendApiDetails)) {
return new Message<AppsExtendApiDetails>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AppsExtendApiDetails>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> delete(
@RequestParam("ids") List<String> ids,
@CurrentUser UserInfo currentUser) {
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsExtendApiDetails> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
logger.debug("-delete ids : {} " , ids);
if (appsService.deleteBatch(ids)) {
return new Message<AppsExtendApiDetails>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AppsExtendApiDetails>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}

View File

@ -19,6 +19,7 @@ package org.dromara.maxkey.web.config.contorller;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import org.dromara.maxkey.authn.annotation.CurrentUser;
import org.dromara.maxkey.entity.AccountsStrategy;
import org.dromara.maxkey.entity.Message;
@ -30,13 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value={"/config/accountsstrategy"})
@ -49,69 +44,63 @@ public class AccountsStrategyController {
@Autowired
AccountsService accountsService;
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
@ResponseBody
public Message<?> fetch(@ModelAttribute AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
@GetMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<JpaPageResults<AccountsStrategy>> fetch(@ModelAttribute AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
accountsStrategy.setInstId(currentUser.getInstId());
JpaPageResults<AccountsStrategy> accountsStrategyList =accountsStrategyService.fetchPageResults(accountsStrategy);
for (AccountsStrategy strategy : accountsStrategyList.getRows()){
strategy.transIconBase64();
}
logger.debug("Accounts Strategy {}" , accountsStrategyList);
return new Message<JpaPageResults<AccountsStrategy>>(
accountsStrategyList);
return new Message<>(accountsStrategyList);
}
@ResponseBody
@RequestMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> query(@ModelAttribute AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
@GetMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AccountsStrategy> query(@ModelAttribute AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
logger.debug("-query : {}" , accountsStrategy);
if (accountsStrategyService.query(accountsStrategy)!=null) {
return new Message<AccountsStrategy>(Message.SUCCESS);
if (CollectionUtils.isNotEmpty(accountsStrategyService.query(accountsStrategy))) {
return new Message<>(Message.SUCCESS);
} else {
return new Message<AccountsStrategy>(Message.SUCCESS);
return new Message<>(Message.FAIL);
}
}
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> get(@PathVariable("id") String id) {
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AccountsStrategy> get(@PathVariable("id") String id) {
AccountsStrategy accountsStrategy = accountsStrategyService.get(id);
return new Message<AccountsStrategy>(accountsStrategy);
return new Message<>(accountsStrategy);
}
@ResponseBody
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> insert(@RequestBody AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AccountsStrategy> insert(@RequestBody AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
logger.debug("-Add : {}" , accountsStrategy);
if (accountsStrategyService.insert(accountsStrategy)) {
accountsService.refreshByStrategy(accountsStrategy);
return new Message<AccountsStrategy>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AccountsStrategy>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> update(@RequestBody AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AccountsStrategy> update(@RequestBody AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
logger.debug("-update : {}" , accountsStrategy);
if (accountsStrategyService.update(accountsStrategy)) {
accountsService.refreshByStrategy(accountsStrategy);
return new Message<AccountsStrategy>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AccountsStrategy>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AccountsStrategy> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
logger.debug("-delete ids : {} " , ids);
if (accountsStrategyService.deleteBatch(ids)) {
return new Message<AccountsStrategy>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AccountsStrategy>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
}

View File

@ -19,6 +19,7 @@ package org.dromara.maxkey.web.config.contorller;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import org.dromara.maxkey.authn.annotation.CurrentUser;
import org.dromara.maxkey.entity.Message;
import org.dromara.maxkey.entity.apps.AppsAdapters;
@ -29,13 +30,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@ -46,62 +41,57 @@ public class AdaptersController {
@Autowired
AppsAdaptersService appsAdaptersService;
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
@ResponseBody
public Message<?> fetch(@ModelAttribute AppsAdapters appsAdapter) {
@GetMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<JpaPageResults<AppsAdapters>> fetch(@ModelAttribute AppsAdapters appsAdapter) {
logger.debug("fetch {}",appsAdapter);
return new Message<JpaPageResults<AppsAdapters>>(
return new Message<>(
appsAdaptersService.fetchPageResults(appsAdapter));
}
@ResponseBody
@RequestMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> query(@ModelAttribute AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
@GetMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsAdapters> query(@ModelAttribute AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
logger.debug("-query : {}" , appsAdapter);
if (appsAdaptersService.query(appsAdapter)!=null) {
return new Message<AppsAdapters>(Message.SUCCESS);
if (CollectionUtils.isNotEmpty(appsAdaptersService.query(appsAdapter))) {
return new Message<>(Message.SUCCESS);
} else {
return new Message<AppsAdapters>(Message.SUCCESS);
return new Message<>(Message.FAIL);
}
}
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> get(@PathVariable("id") String id) {
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsAdapters> get(@PathVariable("id") String id) {
AppsAdapters appsAdapter=appsAdaptersService.get(id);
return new Message<AppsAdapters>(appsAdapter);
return new Message<>(appsAdapter);
}
@ResponseBody
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> insert(@RequestBody AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsAdapters> insert(@RequestBody AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
logger.debug("-Add : {}" , appsAdapter);
if (appsAdaptersService.insert(appsAdapter)) {
return new Message<AppsAdapters>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AppsAdapters>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> update(@RequestBody AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsAdapters> update(@RequestBody AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
logger.debug("-update : {}" , appsAdapter);
if (appsAdaptersService.update(appsAdapter)) {
return new Message<AppsAdapters>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AppsAdapters>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<AppsAdapters> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
logger.debug("-delete ids : {} " , ids);
if (appsAdaptersService.deleteBatch(ids)) {
return new Message<AppsAdapters>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<AppsAdapters>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
}

View File

@ -28,10 +28,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value={"/config/emailsenders"})
@ -41,8 +38,8 @@ public class CnfEmailSendersController {
@Autowired
CnfEmailSendersService emailSendersService;
@RequestMapping(value={"/get"})
public Message<?> get(@CurrentUser UserInfo currentUser){
@GetMapping({"/get"})
public Message<CnfEmailSenders> get(@CurrentUser UserInfo currentUser){
CnfEmailSenders emailSenders = emailSendersService.get(currentUser.getInstId());
if(emailSenders != null && StringUtils.isNotBlank(emailSenders.getCredentials())) {
emailSenders.setCredentials(PasswordReciprocal.getInstance().decoder(emailSenders.getCredentials()));
@ -51,27 +48,26 @@ public class CnfEmailSendersController {
emailSenders.setProtocol("smtp");
emailSenders.setEncoding("utf-8");
}
return new Message<CnfEmailSenders>(emailSenders);
return new Message<>(emailSenders);
}
@RequestMapping(value={"/update"})
@ResponseBody
public Message<?> update( @RequestBody CnfEmailSenders emailSenders,@CurrentUser UserInfo currentUser,BindingResult result) {
@PutMapping({"/update"})
public Message<CnfEmailSenders> update( @RequestBody CnfEmailSenders emailSenders,@CurrentUser UserInfo currentUser,BindingResult result) {
logger.debug("update emailSenders : {}" , emailSenders);
emailSenders.setInstId(currentUser.getInstId());
emailSenders.setCredentials(PasswordReciprocal.getInstance().encode(emailSenders.getCredentials()));
if(StringUtils.isBlank(emailSenders.getId())) {
emailSenders.setId(emailSenders.getInstId());
if(emailSendersService.insert(emailSenders)) {
return new Message<CnfEmailSenders>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
}else {
return new Message<CnfEmailSenders>(Message.ERROR);
return new Message<>(Message.ERROR);
}
}else {
if(emailSendersService.update(emailSenders)) {
return new Message<CnfEmailSenders>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
}else {
return new Message<CnfEmailSenders>(Message.ERROR);
return new Message<>(Message.ERROR);
}
}

View File

@ -31,10 +31,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value={"/config/ldapcontext"})
@ -44,18 +41,17 @@ public class CnfLdapContextController {
@Autowired
CnfLdapContextService ldapContextService;
@RequestMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> get(@CurrentUser UserInfo currentUser){
@GetMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<CnfLdapContext> get(@CurrentUser UserInfo currentUser){
CnfLdapContext ldapContext = ldapContextService.get(currentUser.getInstId());
if(ldapContext != null && StringUtils.isNoneBlank(ldapContext.getCredentials())) {
ldapContext.setCredentials(PasswordReciprocal.getInstance().decoder(ldapContext.getCredentials()));
}
return new Message<CnfLdapContext>(ldapContext);
return new Message<>(ldapContext);
}
@RequestMapping(value={"/update"})
@ResponseBody
public Message<?> update( @RequestBody CnfLdapContext ldapContext,@CurrentUser UserInfo currentUser,BindingResult result) {
@PutMapping({"/update"})
public Message<CnfLdapContext> update( @RequestBody CnfLdapContext ldapContext,@CurrentUser UserInfo currentUser,BindingResult result) {
logger.debug("update ldapContext : {}" ,ldapContext);
ldapContext.setCredentials(PasswordReciprocal.getInstance().encode(ldapContext.getCredentials()));
ldapContext.setInstId(currentUser.getInstId());
@ -67,47 +63,49 @@ public class CnfLdapContextController {
updateResult = ldapContextService.update(ldapContext);
}
if(updateResult) {
return new Message<CnfLdapContext>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<CnfLdapContext>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@RequestMapping(value={"/test"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> test(@CurrentUser UserInfo currentUser){
@GetMapping(value={"/test"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<CnfLdapContext> test(@CurrentUser UserInfo currentUser){
CnfLdapContext ldapContext = ldapContextService.get(currentUser.getInstId());
if(ldapContext != null && StringUtils.isNoneBlank(ldapContext.getCredentials())) {
ldapContext.setCredentials(PasswordReciprocal.getInstance().decoder(ldapContext.getCredentials()));
}
LdapUtils ldapUtils = null;
if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.ActiveDirectory)) {
ldapUtils = new ActiveDirectoryUtils(
ldapContext.getProviderUrl(),
ldapContext.getPrincipal(),
ldapContext.getCredentials(),
ldapContext.getBasedn(),
ldapContext.getMsadDomain());
}else if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.OpenLDAP)) {
ldapUtils = new LdapUtils(
ldapContext.getProviderUrl(),
ldapContext.getPrincipal(),
ldapContext.getCredentials(),
ldapContext.getBasedn());
}else if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.StandardLDAP)) {
ldapUtils = new LdapUtils(
ldapContext.getProviderUrl(),
ldapContext.getPrincipal(),
ldapContext.getCredentials(),
ldapContext.getBasedn());
if(ldapContext != null) {
if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.ActiveDirectory)) {
ldapUtils = new ActiveDirectoryUtils(
ldapContext.getProviderUrl(),
ldapContext.getPrincipal(),
ldapContext.getCredentials(),
ldapContext.getBasedn(),
ldapContext.getMsadDomain());
}else if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.OpenLDAP)) {
ldapUtils = new LdapUtils(
ldapContext.getProviderUrl(),
ldapContext.getPrincipal(),
ldapContext.getCredentials(),
ldapContext.getBasedn());
}else if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.StandardLDAP)) {
ldapUtils = new LdapUtils(
ldapContext.getProviderUrl(),
ldapContext.getPrincipal(),
ldapContext.getCredentials(),
ldapContext.getBasedn());
}
if(ldapUtils != null && ldapUtils.openConnection() != null) {
ldapUtils.close();
return new Message<>(Message.SUCCESS);
}
}
if(ldapUtils.openConnection() != null) {
ldapUtils.close();
return new Message<CnfLdapContext>(Message.SUCCESS);
}else {
return new Message<CnfLdapContext>(Message.FAIL);
}
return new Message<>(Message.FAIL);
}
}

View File

@ -29,10 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
@RestController
@ -43,21 +40,21 @@ public class CnfPasswordPolicyController {
@Autowired
CnfPasswordPolicyService passwordPolicyService;
@RequestMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> get(@CurrentUser UserInfo currentUser){
@GetMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<CnfPasswordPolicy> get(@CurrentUser UserInfo currentUser){
CnfPasswordPolicy passwordPolicy = passwordPolicyService.get(currentUser.getInstId());
return new Message<CnfPasswordPolicy>(passwordPolicy);
return new Message<>(passwordPolicy);
}
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> update(@Valid @RequestBody CnfPasswordPolicy passwordPolicy,@CurrentUser UserInfo currentUser,BindingResult result) {
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<CnfPasswordPolicy> update(@Valid @RequestBody CnfPasswordPolicy passwordPolicy,@CurrentUser UserInfo currentUser,BindingResult result) {
logger.debug("updateRole passwordPolicy : {}" ,passwordPolicy);
//Message message = this.validate(result, passwordPolicy);
if(passwordPolicyService.update(passwordPolicy)) {
return new Message<CnfPasswordPolicy>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<CnfPasswordPolicy>(Message.ERROR);
return new Message<>(Message.ERROR);
}
}

View File

@ -29,10 +29,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value={"/config/smsprovider"})
@ -42,18 +39,17 @@ public class CnfSmsProviderController {
@Autowired
CnfSmsProviderService smsProviderService;
@RequestMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> get(@CurrentUser UserInfo currentUser){
@GetMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<CnfSmsProvider> get(@CurrentUser UserInfo currentUser){
CnfSmsProvider smsProvider = smsProviderService.get(currentUser.getInstId());
if(smsProvider != null && StringUtils.isNoneBlank(smsProvider.getId())) {
smsProvider.setAppSecret(PasswordReciprocal.getInstance().decoder(smsProvider.getAppSecret()));
}
return new Message<CnfSmsProvider>(smsProvider);
return new Message<>(smsProvider);
}
@RequestMapping(value={"/update"})
@ResponseBody
public Message<?> update( @RequestBody CnfSmsProvider smsProvider,@CurrentUser UserInfo currentUser,BindingResult result) {
@PutMapping({"/update"})
public Message<CnfSmsProvider> update( @RequestBody CnfSmsProvider smsProvider,@CurrentUser UserInfo currentUser,BindingResult result) {
logger.debug("update smsProvider : {}" ,smsProvider);
smsProvider.setAppSecret(PasswordReciprocal.getInstance().encode(smsProvider.getAppSecret()));
smsProvider.setInstId(currentUser.getInstId());
@ -65,9 +61,9 @@ public class CnfSmsProviderController {
updateResult = smsProviderService.update(smsProvider);
}
if(updateResult) {
return new Message<CnfSmsProvider>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<CnfSmsProvider>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
}

View File

@ -31,12 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value={"/config/connectors"})
@ -46,60 +41,55 @@ public class ConnectorsController {
@Autowired
ConnectorsService connectorsService;
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
@ResponseBody
public Message<?> fetch(Connectors connector,@CurrentUser UserInfo currentUser) {
@GetMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<JpaPageResults<Connectors>> fetch(Connectors connector,@CurrentUser UserInfo currentUser) {
logger.debug("fetch {}" , connector);
connector.setInstId(currentUser.getInstId());
return new Message<JpaPageResults<Connectors>>(
connectorsService.fetchPageResults(connector));
return new Message<>(connectorsService.fetchPageResults(connector));
}
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> get(@PathVariable("id") String id) {
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Connectors> get(@PathVariable("id") String id) {
Connectors connector = connectorsService.get(id);
if(StringUtils.isNotBlank(connector.getCredentials())) {
connector.setCredentials(PasswordReciprocal.getInstance().decoder(connector.getCredentials()));
}
return new Message<Connectors>(connector);
return new Message<>(connector);
}
@ResponseBody
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> insert(@RequestBody Connectors connector,@CurrentUser UserInfo currentUser) {
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Connectors> insert(@RequestBody Connectors connector,@CurrentUser UserInfo currentUser) {
logger.debug("-Add : {}" , connector);
connector.setInstId(currentUser.getInstId());
if(StringUtils.isNotBlank(connector.getCredentials())) {
connector.setCredentials(PasswordReciprocal.getInstance().encode(connector.getCredentials()));
}
if (connectorsService.insert(connector)) {
return new Message<Connectors>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Connectors>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> update(@RequestBody Connectors connector,@CurrentUser UserInfo currentUser) {
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Connectors> update(@RequestBody Connectors connector,@CurrentUser UserInfo currentUser) {
logger.debug("-update : {}" , connector);
connector.setInstId(currentUser.getInstId());
connector.setCredentials(PasswordReciprocal.getInstance().encode(connector.getCredentials()));
if (connectorsService.update(connector)) {
return new Message<Connectors>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Connectors>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Connectors> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
logger.debug("-delete ids : {} " , ids);
if (connectorsService.deleteBatch(ids)) {
return new Message<Connectors>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Connectors>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}

View File

@ -19,6 +19,7 @@ package org.dromara.maxkey.web.contorller;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import org.dromara.maxkey.authn.annotation.CurrentUser;
import org.dromara.maxkey.constants.ConstsEntryType;
import org.dromara.maxkey.constants.ConstsAct;
@ -38,12 +39,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@ -67,37 +71,34 @@ public class AccountsController {
@Autowired
HistorySystemLogsService systemLog;
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
@ResponseBody
public Message<?> fetch(@ModelAttribute Accounts accounts,@CurrentUser UserInfo currentUser) {
@GetMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<JpaPageResults<Accounts>> fetch(@ModelAttribute Accounts accounts,@CurrentUser UserInfo currentUser) {
_logger.debug("fetch {}" , accounts);
accounts.setInstId(currentUser.getInstId());
return new Message<JpaPageResults<Accounts>>(
return new Message<>(
accountsService.fetchPageResults(accounts));
}
@ResponseBody
@RequestMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> query(@ModelAttribute Accounts account,@CurrentUser UserInfo currentUser) {
@GetMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Accounts> query(@ModelAttribute Accounts account,@CurrentUser UserInfo currentUser) {
_logger.debug("-query : {}" , account);
account.setInstId(currentUser.getInstId());
if (accountsService.query(account)!=null) {
return new Message<Accounts>(Message.SUCCESS);
if (CollectionUtils.isNotEmpty(accountsService.query(account))) {
return new Message<>(Message.SUCCESS);
} else {
return new Message<Accounts>(Message.SUCCESS);
return new Message<>(Message.FAIL);
}
}
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> get(@PathVariable("id") String id) {
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Accounts> get(@PathVariable("id") String id) {
Accounts account=accountsService.get(id);
account.setRelatedPassword(PasswordReciprocal.getInstance().decoder(account.getRelatedPassword()));
return new Message<Accounts>(account);
return new Message<>(account);
}
@ResponseBody
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> insert(@RequestBody Accounts account,@CurrentUser UserInfo currentUser) {
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Accounts> insert(@RequestBody Accounts account,@CurrentUser UserInfo currentUser) {
_logger.debug("-Add : {}" , account);
account.setInstId(currentUser.getInstId());
account.setRelatedPassword(PasswordReciprocal.getInstance().encode(account.getRelatedPassword()));
@ -108,15 +109,14 @@ public class AccountsController {
ConstsAct.CREATE,
ConstsActResult.SUCCESS,
currentUser);
return new Message<Accounts>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Accounts>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> update(@RequestBody Accounts account,@CurrentUser UserInfo currentUser) {
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Accounts> update(@RequestBody Accounts account,@CurrentUser UserInfo currentUser) {
_logger.debug("-update : {}" , account);
account.setInstId(currentUser.getInstId());
account.setRelatedPassword(PasswordReciprocal.getInstance().encode(account.getRelatedPassword()));
@ -127,16 +127,15 @@ public class AccountsController {
ConstsAct.UPDATE,
ConstsActResult.SUCCESS,
currentUser);
return new Message<Accounts>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Accounts>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@RequestMapping(value = { "/updateStatus" }, produces = {MediaType.APPLICATION_JSON_VALUE})
@ResponseBody
public Message<?> updateStatus(@ModelAttribute Accounts accounts,@CurrentUser UserInfo currentUser) {
@GetMapping(value = { "/updateStatus" }, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Accounts> updateStatus(@ModelAttribute Accounts accounts,@CurrentUser UserInfo currentUser) {
_logger.debug("accounts : {}" , accounts);
Accounts loadAccount = accountsService.get(accounts.getId());
accounts.setInstId(currentUser.getInstId());
@ -153,15 +152,14 @@ public class AccountsController {
ConstsAct.statusActon.get(accounts.getStatus()),
ConstsActResult.SUCCESS,
currentUser);
return new Message<Accounts>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Accounts>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public Message<Accounts> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
_logger.debug("-delete ids : {} " , ids);
if (accountsService.deleteBatch(ids)) {
@ -171,21 +169,19 @@ public class AccountsController {
ConstsAct.DELETE,
ConstsActResult.SUCCESS,
currentUser);
return new Message<Accounts>(Message.SUCCESS);
return new Message<>(Message.SUCCESS);
} else {
return new Message<Accounts>(Message.FAIL);
return new Message<>(Message.FAIL);
}
}
@ResponseBody
@RequestMapping(value = "/generate")
public Message<?> generate(@ModelAttribute Accounts account) {
@GetMapping(value = "/generate")
public Message<String> generate(@ModelAttribute Accounts account) {
AccountsStrategy accountsStrategy = accountsStrategyService.get(account.getStrategyId());
UserInfo userInfo = userInfoService.get(account.getUserId());
return new Message<Object>(
Message.SUCCESS,
(Object)accountsService.generateAccount(userInfo,accountsStrategy)
return new Message<>(
Message.SUCCESS,accountsService.generateAccount(userInfo,accountsStrategy)
);
}

View File

@ -228,7 +228,7 @@ springdoc.group-configs[0].paths-to-match =/*
springdoc.group-configs[0].packages-to-scan =org.dromara.maxkey
knife4j.enable =true
knife4j.setting.language =zh_cn
knife4j.setting.language =ZH_CN
knife4j.setting.swagger-model-name =\u5B9E\u4F53\u7C7B\u5217\u8868
############################################################################
#freemarker configuration #

View File

@ -228,7 +228,7 @@ springdoc.group-configs[0].paths-to-match =/*
springdoc.group-configs[0].packages-to-scan =org.dromara.maxkey
knife4j.enable =true
knife4j.setting.language =zh_cn
knife4j.setting.language =ZH_CN
knife4j.setting.swagger-model-name =\u5B9E\u4F53\u7C7B\u5217\u8868
############################################################################
#freemarker configuration #

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
--
-- Host: 127.0.0.1 Database: maxkey
-- ------------------------------------------------------
-- Server version 8.0.32
-- Server version 8.4.0
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@ -15,6 +15,24 @@
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `mxk_access`
--
DROP TABLE IF EXISTS `mxk_access`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_access` (
`ID` varchar(45) NOT NULL COMMENT 'ID',
`GROUPID` varchar(45) NOT NULL COMMENT 'GROUPID',
`APPID` varchar(45) NOT NULL COMMENT 'APPID',
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`INSTID` varchar(45) NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `GROUPID_APPID` (`GROUPID`,`APPID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_accounts`
--
@ -265,6 +283,125 @@ CREATE TABLE `mxk_apps_token_based_details` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_cnf_email_senders`
--
DROP TABLE IF EXISTS `mxk_cnf_email_senders`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_cnf_email_senders` (
`id` varchar(50) NOT NULL,
`smtpHost` varchar(45) DEFAULT NULL,
`port` int DEFAULT NULL,
`account` varchar(45) DEFAULT NULL,
`credentials` varchar(500) DEFAULT NULL,
`sslswitch` int DEFAULT NULL,
`sender` varchar(45) DEFAULT NULL,
`protocol` varchar(45) DEFAULT NULL,
`encoding` varchar(45) DEFAULT NULL,
`status` int DEFAULT NULL,
`instId` varchar(45) DEFAULT NULL,
`description` varchar(45) DEFAULT NULL,
`createdBy` varchar(45) DEFAULT NULL,
`createdDate` datetime DEFAULT CURRENT_TIMESTAMP,
`modifiedBy` varchar(45) DEFAULT NULL,
`modifiedDate` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_cnf_ldap_context`
--
DROP TABLE IF EXISTS `mxk_cnf_ldap_context`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_cnf_ldap_context` (
`id` varchar(50) NOT NULL,
`product` varchar(45) DEFAULT NULL,
`sslswitch` varchar(45) DEFAULT NULL,
`providerurl` varchar(200) DEFAULT NULL,
`principal` varchar(100) DEFAULT NULL,
`credentials` varchar(500) DEFAULT NULL,
`basedn` varchar(500) DEFAULT NULL,
`filters` varchar(500) DEFAULT NULL,
`truststore` varchar(500) DEFAULT NULL,
`truststorepassword` varchar(100) DEFAULT NULL,
`msadDomain` varchar(100) DEFAULT NULL,
`accountMapping` varchar(45) DEFAULT 'YES',
`STATUS` int DEFAULT NULL,
`description` varchar(500) DEFAULT NULL,
`instId` varchar(45) DEFAULT NULL,
`CREATEDBY` varchar(45) DEFAULT NULL,
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`MODIFIEDBY` varchar(45) DEFAULT NULL,
`MODIFIEDDATE` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_cnf_password_policy`
--
DROP TABLE IF EXISTS `mxk_cnf_password_policy`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_cnf_password_policy` (
`ID` varchar(45) NOT NULL,
`MINLENGTH` tinyint unsigned DEFAULT '0' COMMENT 'MINLENGTH',
`MAXLENGTH` tinyint unsigned DEFAULT '0' COMMENT 'MAXLENGTH',
`LOWERCASE` tinyint unsigned DEFAULT '0' COMMENT 'LOWERCASE',
`UPPERCASE` tinyint unsigned DEFAULT '0' COMMENT 'UPPERCASE',
`DIGITS` tinyint unsigned DEFAULT '0' COMMENT 'DIGITS',
`SPECIALCHAR` tinyint unsigned DEFAULT '0' COMMENT 'SPECIALCHAR',
`ATTEMPTS` tinyint unsigned DEFAULT '0' COMMENT 'ATTEMPTS LOGIN FOR LOCK',
`DURATION` tinyint unsigned DEFAULT '0' COMMENT 'DURATION ',
`EXPIRATION` tinyint unsigned DEFAULT '0' COMMENT 'PASSWORD EXPIRATION',
`USERNAME` tinyint unsigned DEFAULT '0' COMMENT 'USERNAME IN PASSWORD',
`HISTORY` tinyint DEFAULT '0' COMMENT 'SIMPLEPASSWORDS NOT USE FOR PASSWORD',
`DICTIONARY` tinyint DEFAULT NULL,
`ALPHABETICAL` tinyint DEFAULT NULL,
`NUMERICAL` tinyint DEFAULT NULL,
`QWERTY` tinyint DEFAULT NULL,
`OCCURANCES` tinyint DEFAULT NULL,
`CREATEDBY` varchar(45) DEFAULT NULL COMMENT 'CREATEDBY',
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'CREATEDDATE',
`MODIFIEDBY` varchar(45) DEFAULT NULL COMMENT 'MODIFIEDBY',
`MODIFIEDDATE` datetime DEFAULT NULL COMMENT 'MODIFIEDDATE',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='password policy';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_cnf_sms_provider`
--
DROP TABLE IF EXISTS `mxk_cnf_sms_provider`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_cnf_sms_provider` (
`id` varchar(50) NOT NULL,
`provider` varchar(100) DEFAULT NULL,
`message` varchar(500) DEFAULT NULL,
`appkey` varchar(100) DEFAULT NULL,
`appsecret` varchar(500) DEFAULT NULL,
`templateid` varchar(45) DEFAULT NULL,
`signname` varchar(45) DEFAULT NULL,
`smssdkappid` varchar(45) DEFAULT NULL COMMENT 'tencentcloud smssdkappid',
`STATUS` int DEFAULT NULL,
`description` varchar(500) DEFAULT NULL,
`instId` varchar(45) DEFAULT NULL,
`CREATEDBY` varchar(45) DEFAULT NULL,
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`MODIFIEDBY` varchar(45) DEFAULT NULL,
`MODIFIEDDATE` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_connectors`
--
@ -294,34 +431,6 @@ CREATE TABLE `mxk_connectors` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='连接器';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_email_senders`
--
DROP TABLE IF EXISTS `mxk_email_senders`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_email_senders` (
`id` varchar(50) NOT NULL,
`smtpHost` varchar(45) DEFAULT NULL,
`port` int DEFAULT NULL,
`account` varchar(45) DEFAULT NULL,
`credentials` varchar(500) DEFAULT NULL,
`sslswitch` int DEFAULT NULL,
`sender` varchar(45) DEFAULT NULL,
`protocol` varchar(45) DEFAULT NULL,
`encoding` varchar(45) DEFAULT NULL,
`status` int DEFAULT NULL,
`instId` varchar(45) DEFAULT NULL,
`description` varchar(45) DEFAULT NULL,
`createdBy` varchar(45) DEFAULT NULL,
`createdDate` datetime DEFAULT CURRENT_TIMESTAMP,
`modifiedBy` varchar(45) DEFAULT NULL,
`modifiedDate` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_file_upload`
--
@ -354,42 +463,9 @@ CREATE TABLE `mxk_group_member` (
`MEMBERID` varchar(100) NOT NULL COMMENT 'MEMBERID USERID OR GROUP ID',
`TYPE` varchar(45) NOT NULL COMMENT 'TYPE USER OR GROUP',
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`INSTID` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_group_permissions`
--
DROP TABLE IF EXISTS `mxk_group_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_group_permissions` (
`ID` varchar(45) NOT NULL COMMENT 'ID',
`GROUPID` varchar(45) NOT NULL COMMENT 'GROUPID',
`APPID` varchar(45) NOT NULL COMMENT 'APPID',
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`INSTID` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_group_privileges`
--
DROP TABLE IF EXISTS `mxk_group_privileges`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_group_privileges` (
`id` varchar(50) NOT NULL,
`appid` varchar(50) DEFAULT NULL,
`groupid` varchar(50) DEFAULT NULL,
`resourceid` varchar(50) DEFAULT NULL,
`CREATEDBY` varchar(45) DEFAULT NULL,
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`status` int DEFAULT '1',
`INSTID` varchar(45) DEFAULT NULL
`INSTID` varchar(45) NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `GROUPID_MEMBERID` (`GROUPID`,`MEMBERID`,`TYPE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -621,37 +697,6 @@ CREATE TABLE `mxk_institutions` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='institutions机构表存放租户信息multi-tenancy';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_ldap_context`
--
DROP TABLE IF EXISTS `mxk_ldap_context`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_ldap_context` (
`id` varchar(50) NOT NULL,
`product` varchar(45) DEFAULT NULL,
`sslswitch` varchar(45) DEFAULT NULL,
`providerurl` varchar(200) DEFAULT NULL,
`principal` varchar(100) DEFAULT NULL,
`credentials` varchar(500) DEFAULT NULL,
`basedn` varchar(500) DEFAULT NULL,
`filters` varchar(500) DEFAULT NULL,
`truststore` varchar(500) DEFAULT NULL,
`truststorepassword` varchar(100) DEFAULT NULL,
`msadDomain` varchar(100) DEFAULT NULL,
`accountMapping` varchar(45) DEFAULT 'YES',
`STATUS` int DEFAULT NULL,
`description` varchar(500) DEFAULT NULL,
`instId` varchar(45) DEFAULT NULL,
`CREATEDBY` varchar(45) DEFAULT NULL,
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`MODIFIEDBY` varchar(45) DEFAULT NULL,
`MODIFIEDDATE` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_localization`
--
@ -746,36 +791,42 @@ CREATE TABLE `mxk_organizations_cast` (
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_password_policy`
-- Table structure for table `mxk_permission`
--
DROP TABLE IF EXISTS `mxk_password_policy`;
DROP TABLE IF EXISTS `mxk_permission`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_password_policy` (
`ID` varchar(45) NOT NULL,
`MINLENGTH` tinyint unsigned DEFAULT '0' COMMENT 'MINLENGTH',
`MAXLENGTH` tinyint unsigned DEFAULT '0' COMMENT 'MAXLENGTH',
`LOWERCASE` tinyint unsigned DEFAULT '0' COMMENT 'LOWERCASE',
`UPPERCASE` tinyint unsigned DEFAULT '0' COMMENT 'UPPERCASE',
`DIGITS` tinyint unsigned DEFAULT '0' COMMENT 'DIGITS',
`SPECIALCHAR` tinyint unsigned DEFAULT '0' COMMENT 'SPECIALCHAR',
`ATTEMPTS` tinyint unsigned DEFAULT '0' COMMENT 'ATTEMPTS LOGIN FOR LOCK',
`DURATION` tinyint unsigned DEFAULT '0' COMMENT 'DURATION ',
`EXPIRATION` tinyint unsigned DEFAULT '0' COMMENT 'PASSWORD EXPIRATION',
`USERNAME` tinyint unsigned DEFAULT '0' COMMENT 'USERNAME IN PASSWORD',
`HISTORY` tinyint DEFAULT '0' COMMENT 'SIMPLEPASSWORDS NOT USE FOR PASSWORD',
`DICTIONARY` tinyint DEFAULT NULL,
`ALPHABETICAL` tinyint DEFAULT NULL,
`NUMERICAL` tinyint DEFAULT NULL,
`QWERTY` tinyint DEFAULT NULL,
`OCCURANCES` tinyint DEFAULT NULL,
`CREATEDBY` varchar(45) DEFAULT NULL COMMENT 'CREATEDBY',
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'CREATEDDATE',
`MODIFIEDBY` varchar(45) DEFAULT NULL COMMENT 'MODIFIEDBY',
`MODIFIEDDATE` datetime DEFAULT NULL COMMENT 'MODIFIEDDATE',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='password policy';
CREATE TABLE `mxk_permission` (
`id` varchar(50) NOT NULL,
`appid` varchar(50) DEFAULT NULL,
`groupid` varchar(50) DEFAULT NULL,
`resourceid` varchar(50) DEFAULT NULL,
`CREATEDBY` varchar(45) DEFAULT NULL,
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`status` int DEFAULT '1',
`INSTID` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_permission_role`
--
DROP TABLE IF EXISTS `mxk_permission_role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_permission_role` (
`id` varchar(50) NOT NULL,
`appid` varchar(50) DEFAULT NULL,
`roleid` varchar(50) DEFAULT NULL,
`resourceid` varchar(50) DEFAULT NULL,
`CREATEDBY` varchar(45) DEFAULT NULL,
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`status` int DEFAULT '1',
`INSTID` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -864,49 +915,10 @@ CREATE TABLE `mxk_role_member` (
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`INSTID` varchar(45) NOT NULL,
PRIMARY KEY (`ID`),
KEY `FK_APPROLEU_REFERENCE_APPROLES` (`ROLEID`)
UNIQUE KEY `ROLEID_MEMBERID` (`ROLEID`,`MEMBERID`,`TYPE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='group member,USERS OR GROUPS';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_role_permissions`
--
DROP TABLE IF EXISTS `mxk_role_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_role_permissions` (
`ID` varchar(45) NOT NULL COMMENT 'ID',
`ROLEID` varchar(45) NOT NULL COMMENT 'GROUPID',
`APPID` varchar(45) NOT NULL COMMENT 'APPID',
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`INSTID` varchar(45) NOT NULL,
PRIMARY KEY (`ID`),
KEY `FK_APPROLEA_REFERENCE_APPLICAT` (`APPID`),
KEY `FK_APPROLEA_REFERENCE_APPROLES` (`ROLEID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='group privileges';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_role_privileges`
--
DROP TABLE IF EXISTS `mxk_role_privileges`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_role_privileges` (
`id` varchar(50) NOT NULL,
`appid` varchar(50) DEFAULT NULL,
`roleid` varchar(50) DEFAULT NULL,
`resourceid` varchar(50) DEFAULT NULL,
`CREATEDBY` varchar(45) DEFAULT NULL,
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`status` int DEFAULT '1',
`INSTID` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_roles`
--
@ -931,37 +943,11 @@ CREATE TABLE `mxk_roles` (
`MODIFIEDDATE` datetime DEFAULT NULL COMMENT 'MODIFIEDDATE',
`DESCRIPTION` varchar(500) DEFAULT NULL COMMENT 'DESCRIPTION',
`INSTID` varchar(45) NOT NULL,
`APPID` varchar(45) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='groups';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_sms_provider`
--
DROP TABLE IF EXISTS `mxk_sms_provider`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_sms_provider` (
`id` varchar(50) NOT NULL,
`provider` varchar(100) DEFAULT NULL,
`message` varchar(500) DEFAULT NULL,
`appkey` varchar(100) DEFAULT NULL,
`appsecret` varchar(500) DEFAULT NULL,
`templateid` varchar(45) DEFAULT NULL,
`signname` varchar(45) DEFAULT NULL,
`smssdkappid` varchar(45) DEFAULT NULL COMMENT 'tencentcloud smssdkappid',
`STATUS` int DEFAULT NULL,
`description` varchar(500) DEFAULT NULL,
`instId` varchar(45) DEFAULT NULL,
`CREATEDBY` varchar(45) DEFAULT NULL,
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
`MODIFIEDBY` varchar(45) DEFAULT NULL,
`MODIFIEDDATE` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_socials_associate`
--
@ -1198,47 +1184,29 @@ CREATE TABLE `mxk_userinfo` (
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mxk_userinfo_adjunct`
-- Table structure for table `sync_job_config_field`
--
DROP TABLE IF EXISTS `mxk_userinfo_adjunct`;
DROP TABLE IF EXISTS `sync_job_config_field`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mxk_userinfo_adjunct` (
`ID` varchar(45) NOT NULL COMMENT '编号',
`USERID` varchar(45) NOT NULL COMMENT '用户编号',
`ORGANIZATION` varchar(45) DEFAULT NULL COMMENT '机构',
`DEPARTMENTID` varchar(45) DEFAULT NULL COMMENT '部门编号',
`DEPARTMENT` varchar(45) DEFAULT NULL COMMENT '部门',
`JOBTITLE` varchar(45) DEFAULT NULL COMMENT '职务',
`JOBLEVEL` varchar(45) DEFAULT NULL COMMENT '工作职级',
`MANAGERID` varchar(45) DEFAULT NULL COMMENT '经理编号',
`MANAGER` varchar(45) DEFAULT NULL COMMENT '经理名字',
`ASSISTANTID` varchar(45) DEFAULT NULL COMMENT '助理编号',
`ASSISTANT` varchar(45) DEFAULT NULL COMMENT '助理名字',
`ENTRYDATE` varchar(45) DEFAULT NULL COMMENT '入司时间',
`STARTWORKDATE` varchar(45) DEFAULT NULL COMMENT '开始工作时间',
`QUITDATE` varchar(45) DEFAULT NULL COMMENT '离职日期',
`SORTORDER` tinyint unsigned DEFAULT '0' COMMENT '部门内排序',
`WORKEMAIL` varchar(45) DEFAULT NULL COMMENT '工作-邮件',
`WORKPHONENUMBER` varchar(45) DEFAULT NULL COMMENT '工作-电话',
`WORKCOUNTRY` varchar(45) DEFAULT NULL COMMENT '工作-国家',
`WORKREGION` varchar(45) DEFAULT NULL COMMENT '工作-省/市',
`WORKLOCALITY` varchar(45) DEFAULT NULL COMMENT '工作-城市',
`WORKSTREETADDRESS` varchar(45) DEFAULT NULL COMMENT '工作-街道',
`WORKADDRESSFORMATTED` varchar(45) DEFAULT NULL COMMENT '工作-地址全称',
`WORKPOSTALCODE` varchar(45) DEFAULT NULL COMMENT '工作-邮编',
`WORKFAX` varchar(45) DEFAULT NULL COMMENT '工作-传真',
`CREATEDBY` varchar(45) DEFAULT NULL COMMENT '创建人',
`CREATEDDATE` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`MODIFIEDBY` varchar(45) DEFAULT NULL COMMENT '修改人',
`MODIFIEDDATE` datetime DEFAULT NULL COMMENT '修改时间',
`DESCRIPTION` varchar(400) DEFAULT NULL COMMENT '描述',
`COSTCENTER` varchar(45) DEFAULT NULL,
`DIVISION` varchar(45) DEFAULT NULL,
`INSTID` varchar(45) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='USER INFO Adjunct';
CREATE TABLE `sync_job_config_field` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
`jobid` bigint NOT NULL DEFAULT '0' COMMENT '同步任务ID',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '规则名',
`objecttype` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '类型',
`targetfield` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '目标字段',
`targetfieldname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '目标字段描述',
`sourcefield` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '来源字段',
`sourcefieldname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '来源字段描述',
`description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '描述',
`createuser` bigint DEFAULT '0' COMMENT '创建人',
`createtime` datetime DEFAULT NULL COMMENT '创建时间',
`updateuser` bigint DEFAULT '0' COMMENT '修改人',
`updatetime` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_job_id` (`jobid`) USING BTREE COMMENT '同步任务ID索引'
) ENGINE=InnoDB AUTO_INCREMENT=214 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='同步任务字段映射表';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@ -1250,4 +1218,4 @@ CREATE TABLE `mxk_userinfo_adjunct` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-05-04 7:31:56
-- Dump completed on 2024-09-28 22:30:00

File diff suppressed because one or more lines are too long