mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-07 01:18:27 +08:00
bug修复+代码调整+日志优化
This commit is contained in:
parent
65bc8c01b9
commit
8fe411648d
@ -22,22 +22,22 @@ import org.dromara.maxkey.authn.jwt.AuthTokenService;
|
|||||||
import org.dromara.maxkey.authn.provider.AbstractAuthenticationProvider;
|
import org.dromara.maxkey.authn.provider.AbstractAuthenticationProvider;
|
||||||
import org.dromara.maxkey.configuration.ApplicationConfig;
|
import org.dromara.maxkey.configuration.ApplicationConfig;
|
||||||
import org.dromara.maxkey.constants.ConstsLoginType;
|
import org.dromara.maxkey.constants.ConstsLoginType;
|
||||||
import org.dromara.maxkey.entity.Institutions;
|
|
||||||
import org.dromara.maxkey.entity.Message;
|
import org.dromara.maxkey.entity.Message;
|
||||||
import org.dromara.maxkey.web.WebConstants;
|
import org.dromara.maxkey.web.WebConstants;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
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.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.nimbusds.jwt.SignedJWT;
|
import com.nimbusds.jwt.SignedJWT;
|
||||||
|
|
||||||
|
|
||||||
@Controller
|
@RestController
|
||||||
@RequestMapping(value = "/login")
|
@RequestMapping(value = "/login")
|
||||||
public class HttpJwtEntryPoint {
|
public class HttpJwtEntryPoint {
|
||||||
private static final Logger _logger = LoggerFactory.getLogger(HttpJwtEntryPoint.class);
|
private static final Logger _logger = LoggerFactory.getLogger(HttpJwtEntryPoint.class);
|
||||||
@ -54,11 +54,11 @@ public class HttpJwtEntryPoint {
|
|||||||
@Autowired
|
@Autowired
|
||||||
JwtLoginService jwtLoginService;
|
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) {
|
public Message<AuthJwt> jwt(@RequestParam(value = WebConstants.JWT_TOKEN_PARAMETER, required = true) String jwt) {
|
||||||
try {
|
try {
|
||||||
//for jwt Login
|
//for jwt Login
|
||||||
_logger.debug("jwt : " + jwt);
|
_logger.debug("jwt : {}" , jwt);
|
||||||
|
|
||||||
SignedJWT signedJWT = jwtLoginService.jwtTokenValidation(jwt);
|
SignedJWT signedJWT = jwtLoginService.jwtTokenValidation(jwt);
|
||||||
|
|
||||||
@ -66,15 +66,15 @@ public class HttpJwtEntryPoint {
|
|||||||
String username =signedJWT.getJWTClaimsSet().getSubject();
|
String username =signedJWT.getJWTClaimsSet().getSubject();
|
||||||
LoginCredential loginCredential =new LoginCredential(username,"",ConstsLoginType.JWT);
|
LoginCredential loginCredential =new LoginCredential(username,"",ConstsLoginType.JWT);
|
||||||
Authentication authentication = authenticationProvider.authenticate(loginCredential,true);
|
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);
|
AuthJwt authJwt = authTokenService.genAuthJwt(authentication);
|
||||||
return new Message<AuthJwt>(authJwt);
|
return new Message<>(authJwt);
|
||||||
}
|
}
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
_logger.error("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
|
* @param jwt
|
||||||
* @return
|
* @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) {
|
public Message<AuthJwt> jwtTrust(@RequestParam(value = WebConstants.JWT_TOKEN_PARAMETER, required = true) String jwt) {
|
||||||
try {
|
try {
|
||||||
//for jwt Login
|
//for jwt Login
|
||||||
_logger.debug("jwt : " + jwt);
|
_logger.debug("jwt : {}" , jwt);
|
||||||
|
|
||||||
if(authTokenService.validateJwtToken(jwt)) {
|
if(authTokenService.validateJwtToken(jwt)) {
|
||||||
String username =authTokenService.resolve(jwt).getSubject();
|
String username =authTokenService.resolve(jwt).getSubject();
|
||||||
LoginCredential loginCredential =new LoginCredential(username,"",ConstsLoginType.JWT);
|
LoginCredential loginCredential =new LoginCredential(username,"",ConstsLoginType.JWT);
|
||||||
Authentication authentication = authenticationProvider.authenticate(loginCredential,true);
|
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);
|
AuthJwt authJwt = authTokenService.genAuthJwt(authentication);
|
||||||
return new Message<AuthJwt>(authJwt);
|
return new Message<>(authJwt);
|
||||||
}
|
}
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
_logger.error("Exception ",e);
|
_logger.error("Exception ",e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Message<AuthJwt>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,7 @@ public class AuthnProviderAutoConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ScanCodeAuthenticationProvider scanCodeAuthenticationProvider(
|
ScanCodeAuthenticationProvider scanCodeAuthenticationProvider(
|
||||||
AbstractAuthenticationRealm authenticationRealm,
|
AbstractAuthenticationRealm authenticationRealm,
|
||||||
SessionManager sessionManager
|
SessionManager sessionManager
|
||||||
) {
|
) {
|
||||||
@ -89,7 +89,7 @@ public class AuthnProviderAutoConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public AppAuthenticationProvider appAuthenticationProvider(
|
AppAuthenticationProvider appAuthenticationProvider(
|
||||||
AbstractAuthenticationRealm authenticationRealm,
|
AbstractAuthenticationRealm authenticationRealm,
|
||||||
ApplicationConfig applicationConfig,
|
ApplicationConfig applicationConfig,
|
||||||
SessionManager sessionManager,
|
SessionManager sessionManager,
|
||||||
@ -104,7 +104,7 @@ public class AuthnProviderAutoConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public MobileAuthenticationProvider mobileAuthenticationProvider(
|
MobileAuthenticationProvider mobileAuthenticationProvider(
|
||||||
AbstractAuthenticationRealm authenticationRealm,
|
AbstractAuthenticationRealm authenticationRealm,
|
||||||
ApplicationConfig applicationConfig,
|
ApplicationConfig applicationConfig,
|
||||||
SmsOtpAuthnService smsAuthnService,
|
SmsOtpAuthnService smsAuthnService,
|
||||||
@ -120,7 +120,7 @@ public class AuthnProviderAutoConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public TrustedAuthenticationProvider trustedAuthenticationProvider(
|
TrustedAuthenticationProvider trustedAuthenticationProvider(
|
||||||
AbstractAuthenticationRealm authenticationRealm,
|
AbstractAuthenticationRealm authenticationRealm,
|
||||||
ApplicationConfig applicationConfig,
|
ApplicationConfig applicationConfig,
|
||||||
SessionManager sessionManager
|
SessionManager sessionManager
|
||||||
@ -134,17 +134,17 @@ public class AuthnProviderAutoConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public PasswordPolicyValidator passwordPolicyValidator(JdbcTemplate jdbcTemplate,MessageSource messageSource) {
|
PasswordPolicyValidator passwordPolicyValidator(JdbcTemplate jdbcTemplate,MessageSource messageSource) {
|
||||||
return new PasswordPolicyValidator(jdbcTemplate,messageSource);
|
return new PasswordPolicyValidator(jdbcTemplate,messageSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public LoginRepository loginRepository(JdbcTemplate jdbcTemplate) {
|
LoginRepository loginRepository(JdbcTemplate jdbcTemplate) {
|
||||||
return new LoginRepository(jdbcTemplate);
|
return new LoginRepository(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public LoginHistoryRepository loginHistoryRepository(JdbcTemplate jdbcTemplate) {
|
LoginHistoryRepository loginHistoryRepository(JdbcTemplate jdbcTemplate) {
|
||||||
return new LoginHistoryRepository(jdbcTemplate);
|
return new LoginHistoryRepository(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ public class AuthnProviderAutoConfiguration {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public AbstractRemeberMeManager remeberMeManager(
|
AbstractRemeberMeManager remeberMeManager(
|
||||||
@Value("${maxkey.server.persistence}") int persistence,
|
@Value("${maxkey.server.persistence}") int persistence,
|
||||||
@Value("${maxkey.login.remeberme.validity}") int validity,
|
@Value("${maxkey.login.remeberme.validity}") int validity,
|
||||||
ApplicationConfig applicationConfig,
|
ApplicationConfig applicationConfig,
|
||||||
|
|||||||
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
package org.dromara.maxkey.autoconfigure;
|
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.JdbcSocialsAssociateService;
|
||||||
import org.dromara.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService;
|
import org.dromara.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService;
|
||||||
import org.dromara.maxkey.authn.support.socialsignon.token.RedisTokenStore;
|
import org.dromara.maxkey.authn.support.socialsignon.token.RedisTokenStore;
|
||||||
@ -42,11 +40,10 @@ public class SocialSignOnAutoConfiguration{
|
|||||||
|
|
||||||
@Bean(name = "socialSignOnProviderService")
|
@Bean(name = "socialSignOnProviderService")
|
||||||
@ConditionalOnClass(SocialsProvider.class)
|
@ConditionalOnClass(SocialsProvider.class)
|
||||||
public SocialSignOnProviderService socialSignOnProviderService(
|
SocialSignOnProviderService socialSignOnProviderService(
|
||||||
@Value("${maxkey.server.persistence}") int persistence,
|
@Value("${maxkey.server.persistence}") int persistence,
|
||||||
JdbcTemplate jdbcTemplate,
|
JdbcTemplate jdbcTemplate,
|
||||||
RedisConnectionFactory redisConnFactory
|
RedisConnectionFactory redisConnFactory) {
|
||||||
) throws IOException {
|
|
||||||
SocialSignOnProviderService socialSignOnProviderService = new SocialSignOnProviderService(jdbcTemplate);
|
SocialSignOnProviderService socialSignOnProviderService = new SocialSignOnProviderService(jdbcTemplate);
|
||||||
//load default Social Providers from database
|
//load default Social Providers from database
|
||||||
socialSignOnProviderService.loadSocials("1");
|
socialSignOnProviderService.loadSocials("1");
|
||||||
@ -59,7 +56,7 @@ public class SocialSignOnAutoConfiguration{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "socialsAssociateService")
|
@Bean(name = "socialsAssociateService")
|
||||||
public JdbcSocialsAssociateService socialsAssociateService(
|
JdbcSocialsAssociateService socialsAssociateService(
|
||||||
JdbcTemplate jdbcTemplate) {
|
JdbcTemplate jdbcTemplate) {
|
||||||
JdbcSocialsAssociateService socialsAssociateService = new JdbcSocialsAssociateService(jdbcTemplate);
|
JdbcSocialsAssociateService socialsAssociateService = new JdbcSocialsAssociateService(jdbcTemplate);
|
||||||
_logger.debug("JdbcSocialsAssociateService inited.");
|
_logger.debug("JdbcSocialsAssociateService inited.");
|
||||||
|
|||||||
@ -20,7 +20,7 @@ package org.dromara.maxkey.web;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Controller;
|
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 org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@ -34,9 +34,9 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class ExceptionEndpoint {
|
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(
|
public ModelAndView error400(
|
||||||
HttpServletRequest request, HttpServletResponse response) {
|
HttpServletRequest request, HttpServletResponse response) {
|
||||||
_logger.debug("Exception BAD_REQUEST");
|
_logger.debug("Exception BAD_REQUEST");
|
||||||
@ -49,20 +49,20 @@ public class ExceptionEndpoint {
|
|||||||
* @param response HttpServletResponse
|
* @param response HttpServletResponse
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = { "/exception/error/404" })
|
@GetMapping({ "/exception/error/404" })
|
||||||
public ModelAndView error404(
|
public ModelAndView error404(
|
||||||
HttpServletRequest request, HttpServletResponse response) {
|
HttpServletRequest request, HttpServletResponse response) {
|
||||||
_logger.debug("Exception PAGE NOT_FOUND ");
|
_logger.debug("Exception PAGE NOT_FOUND ");
|
||||||
return new ModelAndView("exception/404");
|
return new ModelAndView("exception/404");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/exception/error/500" })
|
@GetMapping({ "/exception/error/500" })
|
||||||
public ModelAndView error500(HttpServletRequest request, HttpServletResponse response) {
|
public ModelAndView error500(HttpServletRequest request, HttpServletResponse response) {
|
||||||
_logger.debug("Exception INTERNAL_SERVER_ERROR ");
|
_logger.debug("Exception INTERNAL_SERVER_ERROR ");
|
||||||
return new ModelAndView("exception/500");
|
return new ModelAndView("exception/500");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/exception/accessdeny" })
|
@GetMapping({ "/exception/accessdeny" })
|
||||||
public ModelAndView accessdeny(HttpServletRequest request, HttpServletResponse response) {
|
public ModelAndView accessdeny(HttpServletRequest request, HttpServletResponse response) {
|
||||||
_logger.debug("exception/accessdeny ");
|
_logger.debug("exception/accessdeny ");
|
||||||
return new ModelAndView("exception/accessdeny");
|
return new ModelAndView("exception/accessdeny");
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.dromara.maxkey.constants.ConstsRoles;
|
import org.dromara.maxkey.constants.ConstsRoles;
|
||||||
import org.dromara.maxkey.constants.ConstsStatus;
|
import org.dromara.maxkey.constants.ConstsStatus;
|
||||||
@ -88,7 +88,7 @@ public class LoginRepository {
|
|||||||
listUserInfo = findByUsernameOrMobileOrEmail(username,password);
|
listUserInfo = findByUsernameOrMobileOrEmail(username,password);
|
||||||
}
|
}
|
||||||
_logger.debug("load UserInfo : {}" , listUserInfo);
|
_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) {
|
public List<UserInfo> findByUsername(String username, String password) {
|
||||||
|
|||||||
@ -217,13 +217,13 @@ public class PasswordPolicyValidator {
|
|||||||
*/
|
*/
|
||||||
public void lockUser(UserInfo userInfo) {
|
public void lockUser(UserInfo userInfo) {
|
||||||
try {
|
try {
|
||||||
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId())) {
|
if (userInfo != null
|
||||||
if(userInfo.getIsLocked() == ConstsStatus.ACTIVE) {
|
&& StringUtils.isNotEmpty(userInfo.getId())
|
||||||
jdbcTemplate.update(LOCK_USER_UPDATE_STATEMENT,
|
&& userInfo.getIsLocked() == ConstsStatus.ACTIVE) {
|
||||||
new Object[] { ConstsStatus.LOCK, new Date(), userInfo.getId() },
|
jdbcTemplate.update(LOCK_USER_UPDATE_STATEMENT,
|
||||||
new int[] { Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR });
|
new Object[] { ConstsStatus.LOCK, new Date(), userInfo.getId() },
|
||||||
userInfo.setIsLocked(ConstsStatus.LOCK);
|
new int[] { Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR });
|
||||||
}
|
userInfo.setIsLocked(ConstsStatus.LOCK);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_logger.error("lockUser Exception",e);
|
_logger.error("lockUser Exception",e);
|
||||||
@ -297,10 +297,8 @@ public class PasswordPolicyValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void resetBadPasswordCount(UserInfo userInfo) {
|
public void resetBadPasswordCount(UserInfo userInfo) {
|
||||||
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId())) {
|
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId()) && userInfo.getBadPasswordCount()>0) {
|
||||||
if(userInfo.getBadPasswordCount()>0) {
|
setBadPasswordCount(userInfo.getId(),0);
|
||||||
setBadPasswordCount(userInfo.getId(),0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,6 @@ public class InstitutionsService extends JpaService<Institutions>{
|
|||||||
|
|
||||||
public Institutions findByDomain(String domain) {
|
public Institutions findByDomain(String domain) {
|
||||||
return getMapper().findByDomain(domain);
|
return getMapper().findByDomain(domain);
|
||||||
};
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -244,7 +244,7 @@ public class UserInfoService extends JpaService<UserInfo> {
|
|||||||
if(StringUtils.isNotBlank(changePassword.getPassword())) {
|
if(StringUtils.isNotBlank(changePassword.getPassword())) {
|
||||||
String password = passwordEncoder.encode(changePassword.getPassword());
|
String password = passwordEncoder.encode(changePassword.getPassword());
|
||||||
changePassword.setDecipherable(PasswordReciprocal.getInstance().encode(changePassword.getPassword()));
|
changePassword.setDecipherable(PasswordReciprocal.getInstance().encode(changePassword.getPassword()));
|
||||||
_logger.debug("decipherable : "+changePassword.getDecipherable());
|
_logger.debug("decipherable : {}",changePassword.getDecipherable());
|
||||||
changePassword.setPassword(password);
|
changePassword.setPassword(password);
|
||||||
changePassword.setPasswordLastSetTime(new Date());
|
changePassword.setPasswordLastSetTime(new Date());
|
||||||
|
|
||||||
@ -303,10 +303,10 @@ public class UserInfoService extends JpaService<UserInfo> {
|
|||||||
*/
|
*/
|
||||||
public boolean changePassword(ChangePassword changePassword,boolean passwordPolicy) {
|
public boolean changePassword(ChangePassword changePassword,boolean passwordPolicy) {
|
||||||
try {
|
try {
|
||||||
_logger.debug("decipherable old : " + changePassword.getDecipherable());
|
_logger.debug("decipherable old : {}" , changePassword.getDecipherable());
|
||||||
_logger.debug("decipherable new : " + PasswordReciprocal.getInstance().encode(changePassword.getDecipherable()));
|
_logger.debug("decipherable new : {}" , PasswordReciprocal.getInstance().encode(changePassword.getDecipherable()));
|
||||||
|
|
||||||
if (passwordPolicy && passwordPolicyValidator.validator(changePassword) == false) {
|
if (passwordPolicy && !passwordPolicyValidator.validator(changePassword)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,10 +333,7 @@ public class UserInfoService extends JpaService<UserInfo> {
|
|||||||
if(changePassworded !=null && StringUtils.isNotBlank(changePassworded.getPassword())) {
|
if(changePassworded !=null && StringUtils.isNotBlank(changePassworded.getPassword())) {
|
||||||
UserInfo loadUserInfo = findByUsername(changePassworded.getUsername());
|
UserInfo loadUserInfo = findByUsername(changePassworded.getUsername());
|
||||||
ChangePassword changePassword = new ChangePassword(loadUserInfo);
|
ChangePassword changePassword = new ChangePassword(loadUserInfo);
|
||||||
provisionService.send(
|
provisionService.send(ProvisionTopic.PASSWORD_TOPIC, changePassword, ProvisionAct.PASSWORD);
|
||||||
ProvisionTopic.PASSWORD_TOPIC,
|
|
||||||
changePassword,
|
|
||||||
ProvisionAct.PASSWORD);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class AuthorizeBaseEndpoint {
|
|||||||
protected Apps getApp(String id){
|
protected Apps getApp(String id){
|
||||||
Apps app=(Apps)WebContext.getAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP);
|
Apps app=(Apps)WebContext.getAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP);
|
||||||
if(StringUtils.isBlank(id)) {
|
if(StringUtils.isBlank(id)) {
|
||||||
_logger.error("parameter for app id " + id + " is null.");
|
_logger.error("parameter for app id {} is null.",id);
|
||||||
}else {
|
}else {
|
||||||
//session中为空或者id不一致重新加载
|
//session中为空或者id不一致重新加载
|
||||||
if(app == null || !app.getId().equalsIgnoreCase(id)) {
|
if(app == null || !app.getId().equalsIgnoreCase(id)) {
|
||||||
@ -65,7 +65,7 @@ public class AuthorizeBaseEndpoint {
|
|||||||
WebContext.setAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP, app);
|
WebContext.setAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP, app);
|
||||||
}
|
}
|
||||||
if(app == null){
|
if(app == null){
|
||||||
_logger.error("Applications id " + id + " is not exist.");
|
_logger.error("Applications id {} is not exist.",id);
|
||||||
}
|
}
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,13 +28,7 @@ import org.dromara.maxkey.entity.Accounts;
|
|||||||
import org.dromara.maxkey.entity.Message;
|
import org.dromara.maxkey.entity.Message;
|
||||||
import org.dromara.maxkey.entity.apps.Apps;
|
import org.dromara.maxkey.entity.apps.Apps;
|
||||||
import org.dromara.maxkey.entity.idm.UserInfo;
|
import org.dromara.maxkey.entity.idm.UserInfo;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Crystal.Sea
|
* @author Crystal.Sea
|
||||||
@ -44,7 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
@RequestMapping(value = { "/authz/credential" })
|
@RequestMapping(value = { "/authz/credential" })
|
||||||
public class AuthorizeCredentialEndpoint extends AuthorizeBaseEndpoint{
|
public class AuthorizeCredentialEndpoint extends AuthorizeBaseEndpoint{
|
||||||
|
|
||||||
@RequestMapping("/get/{appId}")
|
@GetMapping("/get/{appId}")
|
||||||
public Message<Accounts> get(
|
public Message<Accounts> get(
|
||||||
@PathVariable("appId") String appId,
|
@PathVariable("appId") String appId,
|
||||||
@CurrentUser UserInfo currentUser){
|
@CurrentUser UserInfo currentUser){
|
||||||
@ -64,30 +58,30 @@ public class AuthorizeCredentialEndpoint extends AuthorizeBaseEndpoint{
|
|||||||
account.setCreateType("manual");
|
account.setCreateType("manual");
|
||||||
account.setStatus(ConstsStatus.ACTIVE);
|
account.setStatus(ConstsStatus.ACTIVE);
|
||||||
}
|
}
|
||||||
return new Message<Accounts>(account);
|
return new Message<>(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/update")
|
@PutMapping("/update")
|
||||||
public Message<Accounts> update(
|
public Message<Accounts> update(
|
||||||
@RequestBody Accounts account,
|
@RequestBody Accounts account,
|
||||||
@CurrentUser UserInfo currentUser){
|
@CurrentUser UserInfo currentUser){
|
||||||
if(StringUtils.isNotEmpty(account.getRelatedPassword())
|
if(StringUtils.isNotEmpty(account.getRelatedUsername())
|
||||||
&&StringUtils.isNotEmpty(account.getRelatedPassword())){
|
&&StringUtils.isNotEmpty(account.getRelatedPassword())){
|
||||||
account.setInstId(currentUser.getInstId());
|
account.setInstId(currentUser.getInstId());
|
||||||
account.setRelatedPassword(
|
account.setRelatedPassword(
|
||||||
PasswordReciprocal.getInstance().encode(account.getRelatedPassword()));
|
PasswordReciprocal.getInstance().encode(account.getRelatedPassword()));
|
||||||
if(accountsService.get(account.getId()) == null) {
|
if(accountsService.get(account.getId()) == null) {
|
||||||
if(accountsService.insert(account)){
|
if(accountsService.insert(account)){
|
||||||
return new Message<Accounts>();
|
return new Message<>();
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(accountsService.update(account)){
|
if(accountsService.update(account)){
|
||||||
return new Message<Accounts>();
|
return new Message<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Message<Accounts>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,8 +30,8 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
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.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -52,13 +52,11 @@ public class AuthorizeEndpoint extends AuthorizeBaseEndpoint{
|
|||||||
|
|
||||||
//all single sign on url
|
//all single sign on url
|
||||||
@Operation(summary = "认证总地址接口", description = "参数应用ID,分发到不同应用的认证地址",method="GET")
|
@Operation(summary = "认证总地址接口", description = "参数应用ID,分发到不同应用的认证地址",method="GET")
|
||||||
@RequestMapping("/authz/{id}")
|
@GetMapping("/authz/{id}")
|
||||||
public ModelAndView authorize(
|
public ModelAndView authorize(HttpServletRequest request,@PathVariable("id") String id){
|
||||||
HttpServletRequest request,
|
Apps app = getApp(id);
|
||||||
@PathVariable("id") String id){
|
|
||||||
ModelAndView modelAndView=null;
|
|
||||||
Apps app=getApp(id);
|
|
||||||
WebContext.setAttribute(WebConstants.SINGLE_SIGN_ON_APP_ID, app.getId());
|
WebContext.setAttribute(WebConstants.SINGLE_SIGN_ON_APP_ID, app.getId());
|
||||||
|
ModelAndView modelAndView = WebContext.redirect(app.getLoginUrl());
|
||||||
|
|
||||||
if(app.getProtocol().equalsIgnoreCase(ConstsProtocols.EXTEND_API)){
|
if(app.getProtocol().equalsIgnoreCase(ConstsProtocols.EXTEND_API)){
|
||||||
modelAndView=WebContext.forward("/authz/api/"+app.getId());
|
modelAndView=WebContext.forward("/authz/api/"+app.getId());
|
||||||
@ -82,12 +80,12 @@ public class AuthorizeEndpoint extends AuthorizeBaseEndpoint{
|
|||||||
modelAndView=WebContext.redirect(app.getLoginUrl());
|
modelAndView=WebContext.redirect(app.getLoginUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.debug(modelAndView.getViewName());
|
_logger.debug("redirect to view {}",modelAndView.getViewName());
|
||||||
|
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/authz/refused")
|
@GetMapping("/authz/refused")
|
||||||
public ModelAndView refused(){
|
public ModelAndView refused(){
|
||||||
ModelAndView modelAndView = new ModelAndView("authorize/authorize_refused");
|
ModelAndView modelAndView = new ModelAndView("authorize/authorize_refused");
|
||||||
Apps app = (Apps)WebContext.getAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP);
|
Apps app = (Apps)WebContext.getAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP);
|
||||||
|
|||||||
@ -26,8 +26,8 @@ import org.dromara.maxkey.entity.idm.UserInfo;
|
|||||||
import org.dromara.maxkey.web.WebConstants;
|
import org.dromara.maxkey.web.WebConstants;
|
||||||
import org.dromara.maxkey.web.WebContext;
|
import org.dromara.maxkey.web.WebContext;
|
||||||
import org.springframework.stereotype.Controller;
|
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.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@ -39,27 +39,27 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
@Controller
|
@Controller
|
||||||
public class AuthorizeProtectedEndpoint{
|
public class AuthorizeProtectedEndpoint{
|
||||||
|
|
||||||
@RequestMapping("/authz/protected/forward")
|
@GetMapping("/authz/protected/forward")
|
||||||
public ModelAndView forwardProtectedForward(
|
public ModelAndView forwardProtectedForward(
|
||||||
HttpServletRequest request ){
|
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 modelAndView=new ModelAndView("authorize/protected/forward");
|
||||||
modelAndView.addObject("redirect_uri", redirect_uri);
|
modelAndView.addObject("redirect_uri", redirectUri);
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/authz/protected")
|
@GetMapping("/authz/protected")
|
||||||
public ModelAndView authorizeProtected(
|
public ModelAndView authorizeProtected(
|
||||||
@RequestParam("password") String password,
|
@RequestParam("password") String password,
|
||||||
@RequestParam("redirect_uri") String redirect_uri,
|
@RequestParam("redirect_uri") String redirectUri,
|
||||||
@CurrentUser UserInfo currentUser){
|
@CurrentUser UserInfo currentUser){
|
||||||
if( currentUser.getAppLoginPassword().equals(PasswordReciprocal.getInstance().encode(password))){
|
if( currentUser.getAppLoginPassword().equals(PasswordReciprocal.getInstance().encode(password))){
|
||||||
WebContext.setAttribute(WebConstants.CURRENT_SINGLESIGNON_URI, redirect_uri);
|
WebContext.setAttribute(WebConstants.CURRENT_SINGLESIGNON_URI, redirectUri);
|
||||||
return WebContext.redirect(redirect_uri);
|
return WebContext.redirect(redirectUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelAndView modelAndView=new ModelAndView("authorize/protected/forward");
|
ModelAndView modelAndView=new ModelAndView("authorize/protected/forward");
|
||||||
modelAndView.addObject("redirect_uri", redirect_uri);
|
modelAndView.addObject("redirect_uri", redirectUri);
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,8 +57,8 @@ public abstract class AbstractAuthorizeAdapter {
|
|||||||
KeyStoreLoader keyStoreLoader = WebContext.getBean("keyStoreLoader",KeyStoreLoader.class);
|
KeyStoreLoader keyStoreLoader = WebContext.getBean("keyStoreLoader",KeyStoreLoader.class);
|
||||||
try {
|
try {
|
||||||
byte[] signData= CertSigner.sign(data.toString().getBytes(), keyStoreLoader.getKeyStore(), keyStoreLoader.getEntityName(), keyStoreLoader.getKeystorePassword());
|
byte[] signData= CertSigner.sign(data.toString().getBytes(), keyStoreLoader.getKeyStore(), keyStoreLoader.getEntityName(), keyStoreLoader.getKeystorePassword());
|
||||||
_logger.debug("signed Token : "+data);
|
_logger.debug("signed Token : {}",data);
|
||||||
_logger.debug("signature : "+signData.toString());
|
_logger.debug("signature : {}",signData.toString());
|
||||||
|
|
||||||
return Base64Utils.base64UrlEncode(data.toString().getBytes("UTF-8"))+"."+Base64Utils.base64UrlEncode(signData);
|
return Base64Utils.base64UrlEncode(data.toString().getBytes("UTF-8"))+"."+Base64Utils.base64UrlEncode(signData);
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
@ -79,8 +79,8 @@ public abstract class AbstractAuthorizeAdapter {
|
|||||||
public Object encrypt(Object data,String algorithmKey,String algorithm){
|
public Object encrypt(Object data,String algorithmKey,String algorithm){
|
||||||
|
|
||||||
algorithmKey = PasswordReciprocal.getInstance().decoder(algorithmKey);
|
algorithmKey = PasswordReciprocal.getInstance().decoder(algorithmKey);
|
||||||
_logger.debug("algorithm : "+algorithm);
|
_logger.debug("algorithm : {}",algorithm);
|
||||||
_logger.debug("algorithmKey : "+algorithmKey);
|
_logger.debug("algorithmKey : {}",algorithmKey);
|
||||||
//Chinese , encode data to HEX
|
//Chinese , encode data to HEX
|
||||||
try {
|
try {
|
||||||
data = new String(Hex.encodeHex(data.toString().getBytes("UTF-8")));
|
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);
|
byte[] encodeData = ReciprocalUtils.encode(data.toString(), algorithmKey, algorithm);
|
||||||
String tokenString = Base64Utils.base64UrlEncode(encodeData);
|
String tokenString = Base64Utils.base64UrlEncode(encodeData);
|
||||||
_logger.trace("Reciprocal then HEX Token : "+tokenString);
|
_logger.trace("Reciprocal then HEX Token : {}",tokenString);
|
||||||
|
|
||||||
return tokenString;
|
return tokenString;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,10 +27,10 @@ import org.dromara.maxkey.authz.cas.endpoint.ticket.CasConstants;
|
|||||||
import org.dromara.maxkey.authz.cas.endpoint.ticket.Ticket;
|
import org.dromara.maxkey.authz.cas.endpoint.ticket.Ticket;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
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.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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
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
|
* https://apereo.github.io/cas/6.2.x/protocol/CAS-Protocol-Specification.html
|
||||||
*/
|
*/
|
||||||
@Tag(name = "2-3-CAS API文档模块")
|
@Tag(name = "2-3-CAS API文档模块")
|
||||||
@Controller
|
@RestController
|
||||||
public class Cas10AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
|
public class Cas10AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
|
||||||
|
|
||||||
static final Logger _logger = LoggerFactory.getLogger(Cas10AuthorizeEndpoint.class);
|
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>
|
<LF>
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "CAS 1.0 ticket验证接口", description = "通过ticket获取当前登录用户信息",method="POST")
|
@Operation(summary = "CAS 1.0 ticket验证接口", description = "通过ticket获取当前登录用户信息",method="POST")
|
||||||
@RequestMapping(CasConstants.ENDPOINT.ENDPOINT_VALIDATE)
|
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_VALIDATE,method={RequestMethod.GET,RequestMethod.POST})
|
||||||
@ResponseBody
|
|
||||||
public String validate(
|
public String validate(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.TICKET) String ticket,
|
@RequestParam(value = CasConstants.PARAMETER.TICKET) String ticket,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.SERVICE) String service,
|
@RequestParam(value = CasConstants.PARAMETER.SERVICE) String service,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew
|
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew){
|
||||||
){
|
_logger.debug("serviceValidate ticket {} , service {} , renew {}" , ticket,service,renew);
|
||||||
_logger.debug("serviceValidate "
|
|
||||||
+ " ticket " + ticket
|
|
||||||
+" , service " + service
|
|
||||||
+" , renew " + renew
|
|
||||||
);
|
|
||||||
|
|
||||||
Ticket storedTicket = null;
|
Ticket storedTicket = null;
|
||||||
try {
|
try {
|
||||||
@ -106,7 +100,7 @@ renew [OPTIONAL] - if this parameter is set, ticket validation will only succeed
|
|||||||
|
|
||||||
if(storedTicket != null){
|
if(storedTicket != null){
|
||||||
String principal=((SignPrincipal)storedTicket.getAuthentication().getPrincipal()).getUsername();
|
String principal=((SignPrincipal)storedTicket.getAuthentication().getPrincipal()).getUsername();
|
||||||
_logger.debug("principal "+principal);
|
_logger.debug("principal {}",principal);
|
||||||
return new Service10ResponseBuilder().success()
|
return new Service10ResponseBuilder().success()
|
||||||
.setUser(principal)
|
.setUser(principal)
|
||||||
.serviceResponseBuilder();
|
.serviceResponseBuilder();
|
||||||
|
|||||||
@ -39,11 +39,11 @@ import org.dromara.maxkey.web.HttpResponseConstants;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
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
|
* https://apereo.github.io/cas/6.2.x/protocol/CAS-Protocol-V2-Specification.html
|
||||||
*/
|
*/
|
||||||
@Tag(name = "2-3-CAS API文档模块")
|
@Tag(name = "2-3-CAS API文档模块")
|
||||||
@Controller
|
@RestController
|
||||||
public class Cas20AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
|
public class Cas20AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
|
||||||
|
|
||||||
static final Logger _logger = LoggerFactory.getLogger(Cas20AuthorizeEndpoint.class);
|
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")
|
@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})
|
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_SERVICE_VALIDATE,produces =MediaType.APPLICATION_XML_VALUE,method={RequestMethod.GET,RequestMethod.POST})
|
||||||
@ResponseBody
|
|
||||||
public String serviceValidate(
|
public String serviceValidate(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response,
|
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.PROXY_CALLBACK_URL,required=false) String pgtUrl,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
|
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
||||||
_logger.debug("serviceValidate "
|
_logger.debug("serviceValidate ticket {} , service {} , pgtUrl {} , renew {} , format {}" , ticket,service,pgtUrl,renew,format);
|
||||||
+ " ticket " + ticket
|
|
||||||
+" , service " + service
|
|
||||||
+" , pgtUrl " + pgtUrl
|
|
||||||
+" , renew " + renew
|
|
||||||
+" , format " + format
|
|
||||||
);
|
|
||||||
|
|
||||||
Ticket storedTicket=null;
|
Ticket storedTicket=null;
|
||||||
if(ticket.startsWith(CasConstants.PREFIX.SERVICE_TICKET_PREFIX)) {
|
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")
|
@Operation(summary = "CAS 2.0 ticket代理验证接口", description = "通过ticket获取当前登录用户信息",method="POST")
|
||||||
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_PROXY_VALIDATE,produces =MediaType.APPLICATION_XML_VALUE)
|
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_PROXY_VALIDATE,produces =MediaType.APPLICATION_XML_VALUE,method={RequestMethod.GET,RequestMethod.POST})
|
||||||
@ResponseBody
|
|
||||||
public String proxy(
|
public String proxy(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response,
|
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.PROXY_CALLBACK_URL,required=false) String pgtUrl,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
|
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
||||||
_logger.debug("proxyValidate "
|
_logger.debug("proxyValidate ticket {} , service {} , pgtUrl {} , renew {} , format {}" ,ticket,service, pgtUrl,renew,format);
|
||||||
+ " ticket " + ticket
|
|
||||||
+" , service " + service
|
|
||||||
+" , pgtUrl " + pgtUrl
|
|
||||||
+" , renew " + renew
|
|
||||||
+" , format " + format
|
|
||||||
);
|
|
||||||
|
|
||||||
Ticket storedTicket=null;
|
Ticket storedTicket=null;
|
||||||
if(ticket.startsWith(CasConstants.PREFIX.PROXY_TICKET_PREFIX)) {
|
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.
|
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)
|
@RequestMapping(value=CasConstants.ENDPOINT.ENDPOINT_PROXY ,produces =MediaType.APPLICATION_XML_VALUE,method={RequestMethod.GET,RequestMethod.POST})
|
||||||
@ResponseBody
|
|
||||||
public String proxy(
|
public String proxy(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.PROXY_GRANTING_TICKET) String pgt,
|
@RequestParam(value = CasConstants.PARAMETER.PROXY_GRANTING_TICKET) String pgt,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.TARGET_SERVICE) String targetService,
|
@RequestParam(value = CasConstants.PARAMETER.TARGET_SERVICE) String targetService,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
||||||
_logger.debug("proxy "
|
_logger.debug("proxy pgt {} , targetService {} , format {}" ,pgt,targetService, format);
|
||||||
+ " pgt " + pgt
|
|
||||||
+" , targetService " + targetService
|
|
||||||
+" , format " + format
|
|
||||||
);
|
|
||||||
ProxyServiceResponseBuilder proxyServiceResponseBuilder=new ProxyServiceResponseBuilder(format);
|
ProxyServiceResponseBuilder proxyServiceResponseBuilder=new ProxyServiceResponseBuilder(format);
|
||||||
|
|
||||||
ProxyGrantingTicketImpl proxyGrantingTicketImpl = (ProxyGrantingTicketImpl)casProxyGrantingTicketServices.get(pgt);
|
ProxyGrantingTicketImpl proxyGrantingTicketImpl = (ProxyGrantingTicketImpl)casProxyGrantingTicketServices.get(pgt);
|
||||||
if(proxyGrantingTicketImpl != null) {
|
if(proxyGrantingTicketImpl != null) {
|
||||||
ProxyTicketImpl ProxyTicketImpl = new ProxyTicketImpl(proxyGrantingTicketImpl.getAuthentication(),proxyGrantingTicketImpl.getCasDetails());
|
ProxyTicketImpl proxyTicketImpl = new ProxyTicketImpl(proxyGrantingTicketImpl.getAuthentication(),proxyGrantingTicketImpl.getCasDetails());
|
||||||
String proxyTicket =ticketServices.createTicket(ProxyTicketImpl);
|
String proxyTicket =ticketServices.createTicket(proxyTicketImpl);
|
||||||
proxyServiceResponseBuilder.success().setTicket(proxyTicket).setFormat(format);
|
proxyServiceResponseBuilder.success().setTicket(proxyTicket).setFormat(format);
|
||||||
}else {
|
}else {
|
||||||
proxyServiceResponseBuilder.success().setTicket("").setFormat(format);
|
proxyServiceResponseBuilder.success().setTicket("").setFormat(format);
|
||||||
|
|||||||
@ -67,13 +67,7 @@ public class Cas30AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
|
|||||||
@RequestParam(value = CasConstants.PARAMETER.PROXY_CALLBACK_URL,required=false) String pgtUrl,
|
@RequestParam(value = CasConstants.PARAMETER.PROXY_CALLBACK_URL,required=false) String pgtUrl,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
|
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
||||||
_logger.debug("serviceValidate "
|
_logger.debug("serviceValidate ticket {} , service {} , pgtUrl {} , renew {} , format {}", ticket,service,pgtUrl,renew,format);
|
||||||
+ " ticket " + ticket
|
|
||||||
+" , service " + service
|
|
||||||
+" , pgtUrl " + pgtUrl
|
|
||||||
+" , renew " + renew
|
|
||||||
+" , format " + format
|
|
||||||
);
|
|
||||||
|
|
||||||
Ticket storedTicket=null;
|
Ticket storedTicket=null;
|
||||||
if(ticket.startsWith(CasConstants.PREFIX.SERVICE_TICKET_PREFIX)) {
|
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")
|
@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(
|
public void proxy(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.PROXY_GRANTING_TICKET) String pgt,
|
@RequestParam(value = CasConstants.PARAMETER.PROXY_GRANTING_TICKET) String pgt,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.TARGET_SERVICE) String targetService,
|
@RequestParam(value = CasConstants.PARAMETER.TARGET_SERVICE) String targetService,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
||||||
_logger.debug("proxy "
|
_logger.debug("proxy pgt {} , targetService {} , format {}" , pgt,targetService,format);
|
||||||
+ " pgt " + pgt
|
|
||||||
+" , targetService " + targetService
|
|
||||||
+" , format " + format
|
|
||||||
);
|
|
||||||
ProxyServiceResponseBuilder proxyServiceResponseBuilder=new ProxyServiceResponseBuilder(format);
|
ProxyServiceResponseBuilder proxyServiceResponseBuilder=new ProxyServiceResponseBuilder(format);
|
||||||
ProxyGrantingTicketImpl proxyGrantingTicketImpl = (ProxyGrantingTicketImpl)casProxyGrantingTicketServices.get(pgt);
|
ProxyGrantingTicketImpl proxyGrantingTicketImpl = (ProxyGrantingTicketImpl)casProxyGrantingTicketServices.get(pgt);
|
||||||
if(proxyGrantingTicketImpl != null) {
|
if(proxyGrantingTicketImpl != null) {
|
||||||
ProxyTicketImpl ProxyTicketImpl = new ProxyTicketImpl(proxyGrantingTicketImpl.getAuthentication(),proxyGrantingTicketImpl.getCasDetails());
|
ProxyTicketImpl proxyTicketImpl = new ProxyTicketImpl(proxyGrantingTicketImpl.getAuthentication(),proxyGrantingTicketImpl.getCasDetails());
|
||||||
String proxyTicket =ticketServices.createTicket(ProxyTicketImpl);
|
String proxyTicket =ticketServices.createTicket(proxyTicketImpl);
|
||||||
proxyServiceResponseBuilder.success().setTicket(proxyTicket).setFormat(format);
|
proxyServiceResponseBuilder.success().setTicket(proxyTicket).setFormat(format);
|
||||||
}else {
|
}else {
|
||||||
proxyServiceResponseBuilder.success().setTicket("").setFormat(format);
|
proxyServiceResponseBuilder.success().setTicket("").setFormat(format);
|
||||||
@ -149,7 +139,7 @@ public class Cas30AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "CAS 3.0 ticket代理验证接口", description = "通过ProxyTicket获取当前登录用户信息",method="POST")
|
@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(
|
public void proxy(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response,
|
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.PROXY_CALLBACK_URL,required=false) String pgtUrl,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
|
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
|
||||||
_logger.debug("proxyValidate "
|
_logger.debug("proxyValidate ticket {} , service {} , pgtUrl {} , renew {} , format {}" , ticket,service,pgtUrl,renew,format);
|
||||||
+ " ticket " + ticket
|
|
||||||
+" , service " + service
|
|
||||||
+" , pgtUrl " + pgtUrl
|
|
||||||
+" , renew " + renew
|
|
||||||
+" , format " + format
|
|
||||||
);
|
|
||||||
|
|
||||||
Ticket storedTicket=null;
|
Ticket storedTicket=null;
|
||||||
if(ticket.startsWith(CasConstants.PREFIX.PROXY_TICKET_PREFIX)) {
|
if(ticket.startsWith(CasConstants.PREFIX.PROXY_TICKET_PREFIX)) {
|
||||||
|
|||||||
@ -22,8 +22,8 @@ package org.dromara.maxkey.authz.cas.endpoint;
|
|||||||
|
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
import java.util.Map;
|
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.session.Session;
|
||||||
import org.dromara.maxkey.authn.web.AuthorizationUtils;
|
import org.dromara.maxkey.authn.web.AuthorizationUtils;
|
||||||
import org.dromara.maxkey.authz.cas.endpoint.ticket.CasConstants;
|
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.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
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,
|
public ModelAndView grantingTicket( Principal principal,
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response){
|
HttpServletResponse response){
|
||||||
@ -148,8 +147,8 @@ public class CasAuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
|
|||||||
Map <String, String> parameterMap = (Map <String, String>)WebContext.getAttribute(CasConstants.PARAMETER.PARAMETER_MAP);
|
Map <String, String> parameterMap = (Map <String, String>)WebContext.getAttribute(CasConstants.PARAMETER.PARAMETER_MAP);
|
||||||
parameterMap.remove(CasConstants.PARAMETER.TICKET);
|
parameterMap.remove(CasConstants.PARAMETER.TICKET);
|
||||||
parameterMap.remove(CasConstants.PARAMETER.SERVICE);
|
parameterMap.remove(CasConstants.PARAMETER.SERVICE);
|
||||||
for (String key : parameterMap.keySet()) {
|
for (Entry<String, String> entry : parameterMap.entrySet()) {
|
||||||
callbackUrl.append("&").append(key).append("=").append(parameterMap.get(key));
|
callbackUrl.append("&").append(entry.getKey()).append("=").append(entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ import org.dromara.maxkey.web.WebContext;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Controller;
|
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.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ public class CasLogoutEndpoint extends CasBaseAuthorizeEndpoint{
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "CAS注销接口", description = "CAS注销接口",method="GET")
|
@Operation(summary = "CAS注销接口", description = "CAS注销接口",method="GET")
|
||||||
@RequestMapping(CasConstants.ENDPOINT.ENDPOINT_LOGOUT)
|
@GetMapping(CasConstants.ENDPOINT.ENDPOINT_LOGOUT)
|
||||||
public ModelAndView logout(HttpServletRequest request , HttpServletResponse response,
|
public ModelAndView logout(HttpServletRequest request , HttpServletResponse response,
|
||||||
@RequestParam(value = CasConstants.PARAMETER.SERVICE , required = false) String casService){
|
@RequestParam(value = CasConstants.PARAMETER.SERVICE , required = false) String casService){
|
||||||
StringBuffer logoutUrl = new StringBuffer("/force/logout");
|
StringBuffer logoutUrl = new StringBuffer("/force/logout");
|
||||||
|
|||||||
@ -29,7 +29,6 @@ import org.dromara.maxkey.authn.web.AuthorizationUtils;
|
|||||||
import org.dromara.maxkey.authz.endpoint.AuthorizeBaseEndpoint;
|
import org.dromara.maxkey.authz.endpoint.AuthorizeBaseEndpoint;
|
||||||
import org.dromara.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter;
|
import org.dromara.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter;
|
||||||
import org.dromara.maxkey.authz.jwt.endpoint.adapter.JwtAdapter;
|
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.ConstsBoolean;
|
||||||
import org.dromara.maxkey.constants.ContentType;
|
import org.dromara.maxkey.constants.ContentType;
|
||||||
import org.dromara.maxkey.crypto.jose.keystore.JWKSetKeyStore;
|
import org.dromara.maxkey.crypto.jose.keystore.JWKSetKeyStore;
|
||||||
@ -67,9 +66,6 @@ public class JwtAuthorizeEndpoint extends AuthorizeBaseEndpoint{
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppsJwtDetailsService jwtDetailsService;
|
AppsJwtDetailsService jwtDetailsService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
ApplicationConfig applicationConfig;
|
|
||||||
|
|
||||||
@Operation(summary = "JWT应用ID认证接口", description = "应用ID")
|
@Operation(summary = "JWT应用ID认证接口", description = "应用ID")
|
||||||
@GetMapping("/authz/jwt/{id}")
|
@GetMapping("/authz/jwt/{id}")
|
||||||
public ModelAndView authorize(
|
public ModelAndView authorize(
|
||||||
@ -80,7 +76,7 @@ public class JwtAuthorizeEndpoint extends AuthorizeBaseEndpoint{
|
|||||||
ModelAndView modelAndView=new ModelAndView();
|
ModelAndView modelAndView=new ModelAndView();
|
||||||
Apps application = getApp(id);
|
Apps application = getApp(id);
|
||||||
AppsJwtDetails jwtDetails = jwtDetailsService.getAppDetails(application.getId() , true);
|
AppsJwtDetails jwtDetails = jwtDetailsService.getAppDetails(application.getId() , true);
|
||||||
_logger.debug(""+jwtDetails);
|
_logger.debug("jwtDetails {}",jwtDetails);
|
||||||
jwtDetails.setAdapter(application.getAdapter());
|
jwtDetails.setAdapter(application.getAdapter());
|
||||||
jwtDetails.setIsAdapter(application.getIsAdapter());
|
jwtDetails.setIsAdapter(application.getIsAdapter());
|
||||||
|
|
||||||
@ -94,8 +90,7 @@ public class JwtAuthorizeEndpoint extends AuthorizeBaseEndpoint{
|
|||||||
}
|
}
|
||||||
adapter = (AbstractAuthorizeAdapter)jwtAdapter;
|
adapter = (AbstractAuthorizeAdapter)jwtAdapter;
|
||||||
}else{
|
}else{
|
||||||
JwtAdapter jwtAdapter =new JwtAdapter(jwtDetails);
|
adapter =new JwtAdapter(jwtDetails);
|
||||||
adapter = (AbstractAuthorizeAdapter)jwtAdapter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter.setPrincipal(AuthorizationUtils.getPrincipal());
|
adapter.setPrincipal(AuthorizationUtils.getPrincipal());
|
||||||
|
|||||||
@ -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.DefaultAccessTokenConverter;
|
||||||
import org.dromara.maxkey.authz.oauth2.provider.token.ResourceServerTokenServices;
|
import org.dromara.maxkey.authz.oauth2.provider.token.ResourceServerTokenServices;
|
||||||
import org.springframework.stereotype.Controller;
|
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.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -55,7 +56,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
* @author Joel D'sa
|
* @author Joel D'sa
|
||||||
*/
|
*/
|
||||||
@Tag(name = "2-1-OAuth v2.0 API文档模块")
|
@Tag(name = "2-1-OAuth v2.0 API文档模块")
|
||||||
@Controller
|
@RestController
|
||||||
public class CheckTokenEndpoint {
|
public class CheckTokenEndpoint {
|
||||||
|
|
||||||
private ResourceServerTokenServices resourceServerTokenServices;
|
private ResourceServerTokenServices resourceServerTokenServices;
|
||||||
@ -79,8 +80,7 @@ public class CheckTokenEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "OAuth 2.0 token检查接口", description = "传递参数token",method="POST")
|
@Operation(summary = "OAuth 2.0 token检查接口", description = "传递参数token",method="POST")
|
||||||
@RequestMapping(value = OAuth2Constants.ENDPOINT.ENDPOINT_CHECK_TOKEN)
|
@PostMapping(OAuth2Constants.ENDPOINT.ENDPOINT_CHECK_TOKEN)
|
||||||
@ResponseBody
|
|
||||||
public Map<String, ?> checkToken(@RequestParam(OAuth2Constants.PARAMETER.TOKEN) String value) {
|
public Map<String, ?> checkToken(@RequestParam(OAuth2Constants.PARAMETER.TOKEN) String value) {
|
||||||
|
|
||||||
OAuth2AccessToken token = resourceServerTokenServices.readAccessToken(value);
|
OAuth2AccessToken token = resourceServerTokenServices.readAccessToken(value);
|
||||||
|
|||||||
@ -66,9 +66,9 @@ public class AssertionEndpoint {
|
|||||||
logger.debug("saml20 assertion start.");
|
logger.debug("saml20 assertion start.");
|
||||||
bindingAdapter = (BindingAdapter) request.getSession().getAttribute(
|
bindingAdapter = (BindingAdapter) request.getSession().getAttribute(
|
||||||
WebConstants.AUTHORIZE_SIGN_ON_APP_SAMLV20_ADAPTER);
|
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();
|
AppsSAML20Details saml20Details = bindingAdapter.getSaml20Details();
|
||||||
logger.debug("saml20Details "+saml20Details.getExtendAttr());
|
logger.debug("saml20Details {}",saml20Details.getExtendAttr());
|
||||||
AuthnRequestInfo authnRequestInfo = bindingAdapter.getAuthnRequestInfo();
|
AuthnRequestInfo authnRequestInfo = bindingAdapter.getAuthnRequestInfo();
|
||||||
|
|
||||||
if (authnRequestInfo == null) {
|
if (authnRequestInfo == null) {
|
||||||
@ -77,9 +77,8 @@ public class AssertionEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("AuthnRequestInfo: {}", authnRequestInfo);
|
logger.debug("AuthnRequestInfo: {}", authnRequestInfo);
|
||||||
HashMap <String,String>attributeMap=new HashMap<String,String>();
|
HashMap <String,String>attributeMap=new HashMap<>();
|
||||||
attributeMap.put(WebConstants.ONLINE_TICKET_NAME,
|
attributeMap.put(WebConstants.ONLINE_TICKET_NAME, AuthorizationUtils.getPrincipal().getSessionId());
|
||||||
AuthorizationUtils.getPrincipal().getSessionId());
|
|
||||||
|
|
||||||
//saml20Details
|
//saml20Details
|
||||||
Response authResponse = authnResponseGenerator.generateAuthnResponse(
|
Response authResponse = authnResponseGenerator.generateAuthnResponse(
|
||||||
|
|||||||
@ -123,7 +123,7 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
|
|||||||
@Bean(name = "jaxb2Marshaller")
|
@Bean(name = "jaxb2Marshaller")
|
||||||
Jaxb2Marshaller jaxb2Marshaller() {
|
Jaxb2Marshaller jaxb2Marshaller() {
|
||||||
Jaxb2Marshaller jaxb2Marshaller = new 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;
|
return jaxb2Marshaller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
package org.dromara.maxkey.autoconfigure;
|
package org.dromara.maxkey.autoconfigure;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
import org.dromara.maxkey.persistence.redis.RedisConnectionFactory;
|
import org.dromara.maxkey.persistence.redis.RedisConnectionFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -70,7 +72,7 @@ public class RedisAutoConfiguration {
|
|||||||
poolConfig.setMaxIdle(maxIdle);
|
poolConfig.setMaxIdle(maxIdle);
|
||||||
poolConfig.setMinIdle(minIdle);
|
poolConfig.setMinIdle(minIdle);
|
||||||
poolConfig.setMaxTotal(maxActive);
|
poolConfig.setMaxTotal(maxActive);
|
||||||
poolConfig.setMaxWaitMillis(maxWait);
|
poolConfig.setMaxWait(Duration.ofMillis(maxWait));
|
||||||
|
|
||||||
factory.setPoolConfig(poolConfig);
|
factory.setPoolConfig(poolConfig);
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,7 @@ public class JdbcOrganizationService extends AbstractSynchronizerService impleme
|
|||||||
try {
|
try {
|
||||||
setFieldValue(org,field,value);
|
setFieldValue(org,field,value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_logger.error("setProperty {}", e);
|
_logger.error("setProperty Exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ public class JdbcOrganizationService extends AbstractSynchronizerService impleme
|
|||||||
try {
|
try {
|
||||||
PropertyUtils.setSimpleProperty(org, mapper.getField(), value);
|
PropertyUtils.setSimpleProperty(org, mapper.getField(), value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_logger.error("setSimpleProperty {}", e);
|
_logger.error("setSimpleProperty Exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,8 +47,9 @@ import static org.dromara.maxkey.synchronizer.utils.FieldUtil.setFieldValue;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class JdbcUsersService extends AbstractSynchronizerService implements ISynchronizerService {
|
public class JdbcUsersService extends AbstractSynchronizerService implements ISynchronizerService {
|
||||||
final static Logger _logger = LoggerFactory.getLogger(JdbcUsersService.class);
|
static final Logger _logger = LoggerFactory.getLogger(JdbcUsersService.class);
|
||||||
@Autowired
|
|
||||||
|
@Autowired
|
||||||
public SyncJobConfigFieldService syncJobConfigFieldService;
|
public SyncJobConfigFieldService syncJobConfigFieldService;
|
||||||
|
|
||||||
private static final Integer USER_TYPE = 1;
|
private static final Integer USER_TYPE = 1;
|
||||||
@ -122,7 +123,7 @@ public class JdbcUsersService extends AbstractSynchronizerService implements ISy
|
|||||||
try {
|
try {
|
||||||
PropertyUtils.setSimpleProperty(user, mapper.getField(), value);
|
PropertyUtils.setSimpleProperty(user, mapper.getField(), value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_logger.error("setSimpleProperty {}", e);
|
_logger.error("setSimpleProperty ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,8 +50,8 @@ public class FieldUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fieldType == Integer.class || fieldType == int.class) {
|
if (fieldType == Integer.class || fieldType == int.class) {
|
||||||
if (value instanceof Boolean) {
|
if (value instanceof Boolean iValue) {
|
||||||
return (Boolean) value ? 1 : 0;
|
return Boolean.TRUE.equals(iValue) ? 1 : 0;
|
||||||
}
|
}
|
||||||
return Integer.parseInt(value.toString());
|
return Integer.parseInt(value.toString());
|
||||||
} else if (fieldType == Long.class || fieldType == long.class) {
|
} else if (fieldType == Long.class || fieldType == long.class) {
|
||||||
@ -65,10 +65,10 @@ public class FieldUtil {
|
|||||||
} else if (fieldType == DateTime.class) {
|
} else if (fieldType == DateTime.class) {
|
||||||
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
|
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
|
||||||
DateTime dateTime;
|
DateTime dateTime;
|
||||||
if (value instanceof Long) {
|
if (value instanceof Long iValue) {
|
||||||
dateTime = new DateTime((Long) value);
|
dateTime = new DateTime(iValue);
|
||||||
} else if (value instanceof String) {
|
} else if (value instanceof String iValue) {
|
||||||
dateTime = DateTime.parse((String) value);
|
dateTime = DateTime.parse(iValue);
|
||||||
}else {
|
}else {
|
||||||
dateTime = new DateTime(value);
|
dateTime = new DateTime(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "maxkey",
|
"name": "maxkey",
|
||||||
"version": "3.5.0",
|
"version": "4.1.x",
|
||||||
"description": "Leading-Edge IAM Identity and Access Management",
|
"description": "Leading-Edge IAM Identity and Access Management",
|
||||||
"author": "MaxKey <support@maxsso.net>",
|
"author": "MaxKey <support@maxsso.net>",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "maxkey",
|
"name": "maxkey",
|
||||||
"version": "3.5.0",
|
"version": "4.1.x",
|
||||||
"description": "Leading-Edge IAM Identity and Access Management",
|
"description": "Leading-Edge IAM Identity and Access Management",
|
||||||
"author": "MaxKey <support@maxsso.net>",
|
"author": "MaxKey <support@maxsso.net>",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@ -47,9 +47,9 @@ export class GroupEditerComponent implements OnInit {
|
|||||||
submitting: boolean;
|
submitting: boolean;
|
||||||
model: Groups;
|
model: Groups;
|
||||||
} = {
|
} = {
|
||||||
submitting: false,
|
submitting: false,
|
||||||
model: new Groups()
|
model: new Groups()
|
||||||
};
|
};
|
||||||
|
|
||||||
// TreeNodes
|
// TreeNodes
|
||||||
treeNodes = new TreeNodes(false);
|
treeNodes = new TreeNodes(false);
|
||||||
@ -66,7 +66,7 @@ export class GroupEditerComponent implements OnInit {
|
|||||||
private msg: NzMessageService,
|
private msg: NzMessageService,
|
||||||
@Inject(ALAIN_I18N_TOKEN) private i18n: I18NService,
|
@Inject(ALAIN_I18N_TOKEN) private i18n: I18NService,
|
||||||
private cdr: ChangeDetectorRef
|
private cdr: ChangeDetectorRef
|
||||||
) { }
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.tree();
|
this.tree();
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
package org.dromara.maxkey.gateway.controller;
|
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 org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -25,7 +25,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class FallbackController {
|
public class FallbackController {
|
||||||
@RequestMapping("/defaultFallback")
|
@GetMapping("/defaultFallback")
|
||||||
public Map<String , Object> defaultFallback() {
|
public Map<String , Object> defaultFallback() {
|
||||||
Map<String , Object> map = new HashMap<>();
|
Map<String , Object> map = new HashMap<>();
|
||||||
map.put("code", 1);
|
map.put("code", 1);
|
||||||
|
|||||||
@ -35,11 +35,11 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
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.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.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AppListController.
|
* AppListController.
|
||||||
@ -47,7 +47,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||||||
* @author Administrator
|
* @author Administrator
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Controller
|
@RestController
|
||||||
public class AppListController {
|
public class AppListController {
|
||||||
static final Logger logger = LoggerFactory.getLogger(AppListController.class);
|
static final Logger logger = LoggerFactory.getLogger(AppListController.class);
|
||||||
|
|
||||||
@ -65,8 +65,7 @@ public class AppListController {
|
|||||||
* @param gridList 类型
|
* @param gridList 类型
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = { "/appList" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/appList" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@ResponseBody
|
|
||||||
public Message<List<UserApps>> appList(
|
public Message<List<UserApps>> appList(
|
||||||
@RequestParam(value = "gridList", required = false) String gridList,
|
@RequestParam(value = "gridList", required = false) String gridList,
|
||||||
@CurrentUser UserInfo currentUser) {
|
@CurrentUser UserInfo currentUser) {
|
||||||
@ -78,13 +77,11 @@ public class AppListController {
|
|||||||
for (UserApps app : appList) {
|
for (UserApps app : appList) {
|
||||||
app.transIconBase64();
|
app.transIconBase64();
|
||||||
}
|
}
|
||||||
//AuthorizationUtils.setAuthentication(null);
|
return new Message<>(appList);
|
||||||
return new Message<List<UserApps>>(appList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = { "/account/get" })
|
@GetMapping(value = { "/account/get" })
|
||||||
@ResponseBody
|
|
||||||
public Message<Accounts> getAccount(
|
public Message<Accounts> getAccount(
|
||||||
@RequestParam("credential") String credential,
|
@RequestParam("credential") String credential,
|
||||||
@RequestParam("appId") String appId,
|
@RequestParam("appId") String appId,
|
||||||
@ -107,8 +104,7 @@ public class AppListController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/account/update" })
|
@PutMapping(value = { "/account/update" })
|
||||||
@ResponseBody
|
|
||||||
public Message<Accounts> updateAccount(
|
public Message<Accounts> updateAccount(
|
||||||
@RequestParam("credential") String credential,
|
@RequestParam("credential") String credential,
|
||||||
@ModelAttribute Accounts account,
|
@ModelAttribute Accounts account,
|
||||||
|
|||||||
@ -40,13 +40,9 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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;
|
|
||||||
|
|
||||||
@Controller
|
@RestController
|
||||||
@RequestMapping(value = { "/forgotpassword" })
|
@RequestMapping(value = { "/forgotpassword" })
|
||||||
public class ForgotPasswordContorller {
|
public class ForgotPasswordContorller {
|
||||||
private static Logger logger = LoggerFactory.getLogger(ForgotPasswordContorller.class);
|
private static Logger logger = LoggerFactory.getLogger(ForgotPasswordContorller.class);
|
||||||
@ -89,17 +85,15 @@ public class ForgotPasswordContorller {
|
|||||||
@Autowired
|
@Autowired
|
||||||
CnfPasswordPolicyService passwordPolicyService;
|
CnfPasswordPolicyService passwordPolicyService;
|
||||||
|
|
||||||
@RequestMapping(value={"/passwordpolicy"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value={"/passwordpolicy"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<CnfPasswordPolicy> passwordpolicy(){
|
public Message<CnfPasswordPolicy> passwordpolicy(){
|
||||||
CnfPasswordPolicy passwordPolicy = passwordPolicyService.get(WebContext.getInst().getId());
|
CnfPasswordPolicy passwordPolicy = passwordPolicyService.get(WebContext.getInst().getId());
|
||||||
//构建密码强度说明
|
//构建密码强度说明
|
||||||
passwordPolicy.buildMessage();
|
passwordPolicy.buildMessage();
|
||||||
return new Message<CnfPasswordPolicy>(passwordPolicy);
|
return new Message<>(passwordPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = { "/validateCaptcha" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@ResponseBody
|
|
||||||
@RequestMapping(value = { "/validateCaptcha" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
|
||||||
public Message<ChangePassword> validateCaptcha(
|
public Message<ChangePassword> validateCaptcha(
|
||||||
@RequestParam String userId,
|
@RequestParam String userId,
|
||||||
@RequestParam String state,
|
@RequestParam String state,
|
||||||
@ -111,16 +105,14 @@ public class ForgotPasswordContorller {
|
|||||||
if(userInfo != null) {
|
if(userInfo != null) {
|
||||||
AbstractOtpAuthn smsOtpAuthn = smsOtpAuthnService.getByInstId(userInfo.getInstId());
|
AbstractOtpAuthn smsOtpAuthn = smsOtpAuthnService.getByInstId(userInfo.getInstId());
|
||||||
if (otpCaptcha == null || !smsOtpAuthn.validate(userInfo, otpCaptcha)) {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = { "/produceOtp" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@ResponseBody
|
|
||||||
@RequestMapping(value = { "/produceOtp" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
|
||||||
public Message<ChangePassword> produceOtp(
|
public Message<ChangePassword> produceOtp(
|
||||||
@RequestParam String mobile,
|
@RequestParam String mobile,
|
||||||
@RequestParam String state,
|
@RequestParam String state,
|
||||||
@ -129,7 +121,7 @@ public class ForgotPasswordContorller {
|
|||||||
logger.debug(" Mobile {}: " ,mobile);
|
logger.debug(" Mobile {}: " ,mobile);
|
||||||
if (!authTokenService.validateCaptcha(state,captcha)) {
|
if (!authTokenService.validateCaptcha(state,captcha)) {
|
||||||
logger.debug("login captcha valid error.");
|
logger.debug("login captcha valid error.");
|
||||||
return new Message<ChangePassword>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangePassword change = null;
|
ChangePassword change = null;
|
||||||
@ -141,15 +133,14 @@ public class ForgotPasswordContorller {
|
|||||||
change.clearPassword();
|
change.clearPassword();
|
||||||
AbstractOtpAuthn smsOtpAuthn = smsOtpAuthnService.getByInstId(userInfo.getInstId());
|
AbstractOtpAuthn smsOtpAuthn = smsOtpAuthnService.getByInstId(userInfo.getInstId());
|
||||||
smsOtpAuthn.produce(userInfo);
|
smsOtpAuthn.produce(userInfo);
|
||||||
return new Message<ChangePassword>(change);
|
return new Message<>(change);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Message<ChangePassword>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@GetMapping(value = { "/produceEmailOtp" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value = { "/produceEmailOtp" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
|
||||||
public Message<ChangePassword> produceEmailOtp(
|
public Message<ChangePassword> produceEmailOtp(
|
||||||
@RequestParam String email,
|
@RequestParam String email,
|
||||||
@RequestParam String state,
|
@RequestParam String state,
|
||||||
@ -157,7 +148,7 @@ public class ForgotPasswordContorller {
|
|||||||
logger.debug("/forgotpassword/produceEmailOtp Email {} : " , email);
|
logger.debug("/forgotpassword/produceEmailOtp Email {} : " , email);
|
||||||
if (!authTokenService.validateCaptcha(state,captcha)) {
|
if (!authTokenService.validateCaptcha(state,captcha)) {
|
||||||
logger.debug("captcha valid error.");
|
logger.debug("captcha valid error.");
|
||||||
return new Message<ChangePassword>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangePassword change = null;
|
ChangePassword change = null;
|
||||||
@ -168,13 +159,13 @@ public class ForgotPasswordContorller {
|
|||||||
change.clearPassword();
|
change.clearPassword();
|
||||||
AbstractOtpAuthn mailOtpAuthn = mailOtpAuthnService.getMailOtpAuthn(userInfo.getInstId());
|
AbstractOtpAuthn mailOtpAuthn = mailOtpAuthnService.getMailOtpAuthn(userInfo.getInstId());
|
||||||
mailOtpAuthn.produce(userInfo);
|
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(
|
public Message<ChangePassword> setPassWord(
|
||||||
@ModelAttribute ChangePassword changePassword,
|
@ModelAttribute ChangePassword changePassword,
|
||||||
@RequestParam String forgotType,
|
@RequestParam String forgotType,
|
||||||
@ -204,15 +195,15 @@ public class ForgotPasswordContorller {
|
|||||||
ConstsAct.FORGOT_PASSWORD,
|
ConstsAct.FORGOT_PASSWORD,
|
||||||
ConstsActResult.SUCCESS,
|
ConstsActResult.SUCCESS,
|
||||||
loadedUserInfo);
|
loadedUserInfo);
|
||||||
return new Message<ChangePassword>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
}else {
|
}else {
|
||||||
return new Message<ChangePassword>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new Message<ChangePassword>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Message<ChangePassword>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -295,7 +295,7 @@ springdoc.group-configs[0].paths-to-match =/*
|
|||||||
springdoc.group-configs[0].packages-to-scan =org.dromara.maxkey
|
springdoc.group-configs[0].packages-to-scan =org.dromara.maxkey
|
||||||
|
|
||||||
knife4j.enable =true
|
knife4j.enable =true
|
||||||
knife4j.setting.language =zh_cn
|
knife4j.setting.language =ZH_CN
|
||||||
knife4j.setting.swagger-model-name =\u5B9E\u4F53\u7C7B\u5217\u8868
|
knife4j.setting.swagger-model-name =\u5B9E\u4F53\u7C7B\u5217\u8868
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|||||||
@ -32,11 +32,13 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
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.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
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;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -50,9 +52,8 @@ public class AccessController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
HistorySystemLogsService systemLog;
|
HistorySystemLogsService systemLog;
|
||||||
|
|
||||||
@RequestMapping(value = { "/appsInGroup" })
|
@GetMapping(value = { "/appsInGroup" })
|
||||||
@ResponseBody
|
public Message<JpaPageResults<Access>> appsInRole(
|
||||||
public Message<?> appsInRole(
|
|
||||||
@ModelAttribute Access groupPermission,
|
@ModelAttribute Access groupPermission,
|
||||||
@CurrentUser UserInfo currentUser) {
|
@CurrentUser UserInfo currentUser) {
|
||||||
JpaPageResults<Access> groupPermissions;
|
JpaPageResults<Access> groupPermissions;
|
||||||
@ -64,12 +65,11 @@ public class AccessController {
|
|||||||
app.transIconBase64();
|
app.transIconBase64();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Message<JpaPageResults<Access>>(Message.FAIL,groupPermissions);
|
return new Message<>(Message.FAIL,groupPermissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/appsNotInGroup" })
|
@GetMapping(value = { "/appsNotInGroup" })
|
||||||
@ResponseBody
|
public Message<JpaPageResults<Access>> appsNotInRole(
|
||||||
public Message<?> appsNotInRole(
|
|
||||||
@ModelAttribute Access groupPermission,
|
@ModelAttribute Access groupPermission,
|
||||||
@CurrentUser UserInfo currentUser) {
|
@CurrentUser UserInfo currentUser) {
|
||||||
JpaPageResults<Access> groupPermissions;
|
JpaPageResults<Access> groupPermissions;
|
||||||
@ -81,16 +81,15 @@ public class AccessController {
|
|||||||
app.transIconBase64();
|
app.transIconBase64();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Message<JpaPageResults<Access>>(Message.FAIL,groupPermissions);
|
return new Message<>(Message.FAIL,groupPermissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = {"/add"})
|
@PostMapping(value = {"/add"})
|
||||||
@ResponseBody
|
public Message<Access> insertPermission(
|
||||||
public Message<?> insertPermission(
|
|
||||||
@RequestBody Access groupPermission,
|
@RequestBody Access groupPermission,
|
||||||
@CurrentUser UserInfo currentUser) {
|
@CurrentUser UserInfo currentUser) {
|
||||||
if (groupPermission == null || groupPermission.getGroupId() == null) {
|
if (groupPermission == null || groupPermission.getGroupId() == null) {
|
||||||
return new Message<Access>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
String roleId = groupPermission.getGroupId();
|
String roleId = groupPermission.getGroupId();
|
||||||
|
|
||||||
@ -107,20 +106,19 @@ public class AccessController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(result) {
|
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
|
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Access> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-delete ids : {}" , ids);
|
logger.debug("-delete ids : {}" , ids);
|
||||||
if (accessService.deleteBatch(ids)) {
|
if (accessService.deleteBatch(ids)) {
|
||||||
return new Message<Access>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Access>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ package org.dromara.maxkey.web.apps.contorller;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.dromara.maxkey.authn.annotation.CurrentUser;
|
import org.dromara.maxkey.authn.annotation.CurrentUser;
|
||||||
import org.dromara.maxkey.constants.ConstsProtocols;
|
import org.dromara.maxkey.constants.ConstsProtocols;
|
||||||
import org.dromara.maxkey.crypto.ReciprocalUtils;
|
import org.dromara.maxkey.crypto.ReciprocalUtils;
|
||||||
@ -30,14 +31,7 @@ import org.dromara.mybatis.jpa.entity.JpaPageResults;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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 com.nimbusds.jose.JOSEException;
|
import com.nimbusds.jose.JOSEException;
|
||||||
import com.nimbusds.jose.JWEAlgorithm;
|
import com.nimbusds.jose.JWEAlgorithm;
|
||||||
import com.nimbusds.jose.JWSAlgorithm;
|
import com.nimbusds.jose.JWSAlgorithm;
|
||||||
@ -54,19 +48,18 @@ import com.nimbusds.jose.jwk.gen.RSAKeyGenerator;
|
|||||||
public class ApplicationsController extends BaseAppContorller {
|
public class ApplicationsController extends BaseAppContorller {
|
||||||
static final Logger logger = LoggerFactory.getLogger(ApplicationsController.class);
|
static final Logger logger = LoggerFactory.getLogger(ApplicationsController.class);
|
||||||
|
|
||||||
@RequestMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> init() {
|
public Message<Apps> init() {
|
||||||
Apps app=new Apps();
|
Apps app=new Apps();
|
||||||
app.setId(app.generateId());
|
app.setId(app.generateId());
|
||||||
app.setProtocol(ConstsProtocols.BASIC);
|
app.setProtocol(ConstsProtocols.BASIC);
|
||||||
app.setSecret(ReciprocalUtils.generateKey(""));
|
app.setSecret(ReciprocalUtils.generateKey(""));
|
||||||
return new Message<Apps>(app);
|
return new Message<>(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@ResponseBody
|
public Message<JpaPageResults<Apps>> fetch(@ModelAttribute Apps apps,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> fetch(@ModelAttribute Apps apps,@CurrentUser UserInfo currentUser) {
|
|
||||||
apps.setInstId(currentUser.getInstId());
|
apps.setInstId(currentUser.getInstId());
|
||||||
JpaPageResults<Apps> appsList =appsService.fetchPageResults(apps);
|
JpaPageResults<Apps> appsList =appsService.fetchPageResults(apps);
|
||||||
for (Apps app : appsList.getRows()){
|
for (Apps app : appsList.getRows()){
|
||||||
@ -75,80 +68,73 @@ public class ApplicationsController extends BaseAppContorller {
|
|||||||
app.setSharedPassword(null);
|
app.setSharedPassword(null);
|
||||||
}
|
}
|
||||||
logger.debug("List {}" , appsList);
|
logger.debug("List {}" , appsList);
|
||||||
return new Message<JpaPageResults<Apps>>(appsList);
|
return new Message<>(appsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@GetMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Apps> query(@ModelAttribute Apps apps,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> query(@ModelAttribute Apps apps,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-query : {}" , apps);
|
logger.debug("-query : {}" , apps);
|
||||||
if (appsService.query(apps)!=null) {
|
if (CollectionUtils.isNotEmpty(appsService.query(apps))) {
|
||||||
return new Message<Apps>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Apps>(Message.SUCCESS);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> get(@PathVariable("id") String id) {
|
public Message<Apps> get(@PathVariable("id") String id) {
|
||||||
Apps apps = appsService.get(id);
|
Apps apps = appsService.get(id);
|
||||||
decoderSecret(apps);
|
decoderSecret(apps);
|
||||||
apps.transIconBase64();
|
apps.transIconBase64();
|
||||||
return new Message<Apps>(apps);
|
return new Message<>(apps);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Apps> insert(@RequestBody Apps apps,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> insert(@RequestBody Apps apps,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-Add : {}" , apps);
|
logger.debug("-Add : {}" , apps);
|
||||||
transform(apps);
|
transform(apps);
|
||||||
apps.setInstId(currentUser.getInstId());
|
apps.setInstId(currentUser.getInstId());
|
||||||
if (appsService.insert(apps)) {
|
if (appsService.insert(apps)) {
|
||||||
return new Message<Apps>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Apps>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Apps> update(@RequestBody Apps apps,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> update(@RequestBody Apps apps,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-update : {}" , apps);
|
logger.debug("-update : {}" , apps);
|
||||||
transform(apps);
|
transform(apps);
|
||||||
apps.setInstId(currentUser.getInstId());
|
apps.setInstId(currentUser.getInstId());
|
||||||
if (appsService.update(apps)) {
|
if (appsService.update(apps)) {
|
||||||
return new Message<Apps>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Apps>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Apps> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-delete ids : {} " , ids);
|
logger.debug("-delete ids : {} " , ids);
|
||||||
if (appsService.deleteBatch(ids)) {
|
if (appsService.deleteBatch(ids)) {
|
||||||
return new Message<Apps>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Apps>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PostMapping({ "/updateExtendAttr" })
|
||||||
@RequestMapping(value = { "/updateExtendAttr" })
|
public Message<Apps> updateExtendAttr(@RequestBody Apps app) {
|
||||||
public Message<?> updateExtendAttr(@RequestBody Apps app) {
|
|
||||||
logger.debug("-updateExtendAttr id : {} , ExtendAttr : {}" , app.getId(),app.getExtendAttr());
|
logger.debug("-updateExtendAttr id : {} , ExtendAttr : {}" , app.getId(),app.getExtendAttr());
|
||||||
if (appsService.updateExtendAttr(app)) {
|
if (appsService.updateExtendAttr(app)) {
|
||||||
return new Message<Apps>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Apps>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping({ "/generate/secret/{type}" })
|
||||||
@ResponseBody
|
public Message<String> generateSecret(@PathVariable("type") String type,@RequestParam(name="id",required=false) String id) throws JOSEException {
|
||||||
@RequestMapping(value = { "/generate/secret/{type}" })
|
|
||||||
public Message<?> generateSecret(@PathVariable("type") String type,@RequestParam(name="id",required=false) String id) throws JOSEException {
|
|
||||||
String secret="";
|
String secret="";
|
||||||
type=type.toLowerCase();
|
type=type.toLowerCase();
|
||||||
if(type.equals("des")){
|
if(type.equals("des")){
|
||||||
@ -203,7 +189,7 @@ public class ApplicationsController extends BaseAppContorller {
|
|||||||
secret=ReciprocalUtils.generateKey("");
|
secret=ReciprocalUtils.generateKey("");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Message<Object>(Message.SUCCESS,(Object)secret);
|
return new Message<>(Message.SUCCESS,secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -30,12 +30,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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
|
@RestController
|
||||||
@ -46,57 +41,54 @@ public class CasDetailsController extends BaseAppContorller {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppsCasDetailsService casDetailsService;
|
AppsCasDetailsService casDetailsService;
|
||||||
|
|
||||||
@RequestMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> init() {
|
public Message<AppsCasDetails> init() {
|
||||||
AppsCasDetails casDetails =new AppsCasDetails();
|
AppsCasDetails casDetails =new AppsCasDetails();
|
||||||
casDetails.setId(casDetails.generateId());
|
casDetails.setId(casDetails.generateId());
|
||||||
casDetails.setProtocol(ConstsProtocols.CAS);
|
casDetails.setProtocol(ConstsProtocols.CAS);
|
||||||
casDetails.setSecret(ReciprocalUtils.generateKey(""));
|
casDetails.setSecret(ReciprocalUtils.generateKey(""));
|
||||||
return new Message<AppsCasDetails>(casDetails);
|
return new Message<>(casDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> get(@PathVariable("id") String id) {
|
public Message<AppsCasDetails> get(@PathVariable("id") String id) {
|
||||||
AppsCasDetails casDetails=casDetailsService.getAppDetails(id , false);
|
AppsCasDetails casDetails=casDetailsService.getAppDetails(id , false);
|
||||||
super.decoderSecret(casDetails);
|
super.decoderSecret(casDetails);
|
||||||
casDetails.transIconBase64();
|
casDetails.transIconBase64();
|
||||||
return new Message<AppsCasDetails>(casDetails);
|
return new Message<>(casDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AppsCasDetails> insert(@RequestBody AppsCasDetails casDetails,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> insert(@RequestBody AppsCasDetails casDetails,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-Add : {}" , casDetails);
|
logger.debug("-Add : {}" , casDetails);
|
||||||
transform(casDetails);
|
transform(casDetails);
|
||||||
casDetails.setInstId(currentUser.getInstId());
|
casDetails.setInstId(currentUser.getInstId());
|
||||||
if (casDetailsService.insert(casDetails)&&appsService.insertApp(casDetails)) {
|
if (casDetailsService.insert(casDetails)&&appsService.insertApp(casDetails)) {
|
||||||
return new Message<AppsCasDetails>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AppsCasDetails>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AppsCasDetails> update(@RequestBody AppsCasDetails casDetails,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> update(@RequestBody AppsCasDetails casDetails,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-update : {}" , casDetails);
|
logger.debug("-update : {}" , casDetails);
|
||||||
transform(casDetails);
|
transform(casDetails);
|
||||||
casDetails.setInstId(currentUser.getInstId());
|
casDetails.setInstId(currentUser.getInstId());
|
||||||
if (casDetailsService.update(casDetails)&&appsService.updateApp(casDetails)) {
|
if (casDetailsService.update(casDetails)&&appsService.updateApp(casDetails)) {
|
||||||
return new Message<AppsCasDetails>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AppsCasDetails>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AppsCasDetails> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-delete ids : {} " , ids);
|
logger.debug("-delete ids : {} " , ids);
|
||||||
if (casDetailsService.deleteBatch(ids)&&appsService.deleteBatch(ids)) {
|
if (casDetailsService.deleteBatch(ids)&&appsService.deleteBatch(ids)) {
|
||||||
return new Message<AppsCasDetails>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AppsCasDetails>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,12 +30,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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
|
@RestController
|
||||||
@ -43,66 +38,61 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class ExtendApiDetailsController extends BaseAppContorller {
|
public class ExtendApiDetailsController extends BaseAppContorller {
|
||||||
static final Logger logger = LoggerFactory.getLogger(ExtendApiDetailsController.class);
|
static final Logger logger = LoggerFactory.getLogger(ExtendApiDetailsController.class);
|
||||||
|
|
||||||
@RequestMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/init" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> init() {
|
public Message<AppsExtendApiDetails> init() {
|
||||||
AppsExtendApiDetails extendApiDetails=new AppsExtendApiDetails();
|
AppsExtendApiDetails extendApiDetails=new AppsExtendApiDetails();
|
||||||
extendApiDetails.setId(extendApiDetails.generateId());
|
extendApiDetails.setId(extendApiDetails.generateId());
|
||||||
extendApiDetails.setProtocol(ConstsProtocols.EXTEND_API);
|
extendApiDetails.setProtocol(ConstsProtocols.EXTEND_API);
|
||||||
extendApiDetails.setSecret(ReciprocalUtils.generateKey(""));
|
extendApiDetails.setSecret(ReciprocalUtils.generateKey(""));
|
||||||
return new Message<AppsExtendApiDetails>(extendApiDetails);
|
return new Message<>(extendApiDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> get(@PathVariable("id") String id) {
|
public Message<AppsExtendApiDetails> get(@PathVariable("id") String id) {
|
||||||
Apps application= appsService.get(id);
|
Apps application= appsService.get(id);
|
||||||
super.decoderSecret(application);
|
super.decoderSecret(application);
|
||||||
AppsExtendApiDetails extendApiDetails=new AppsExtendApiDetails();
|
AppsExtendApiDetails extendApiDetails=new AppsExtendApiDetails();
|
||||||
BeanUtils.copyProperties(application, extendApiDetails);
|
BeanUtils.copyProperties(application, extendApiDetails);
|
||||||
extendApiDetails.transIconBase64();
|
extendApiDetails.transIconBase64();
|
||||||
return new Message<AppsExtendApiDetails>(extendApiDetails);
|
return new Message<>(extendApiDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AppsExtendApiDetails> add(
|
||||||
public Message<?> add(
|
|
||||||
@RequestBody AppsExtendApiDetails extendApiDetails,
|
@RequestBody AppsExtendApiDetails extendApiDetails,
|
||||||
@CurrentUser UserInfo currentUser) {
|
@CurrentUser UserInfo currentUser) {
|
||||||
logger.debug("-Add :" + extendApiDetails);
|
logger.debug("-Add : {}" , extendApiDetails);
|
||||||
|
|
||||||
transform(extendApiDetails);
|
transform(extendApiDetails);
|
||||||
extendApiDetails.setInstId(currentUser.getInstId());
|
extendApiDetails.setInstId(currentUser.getInstId());
|
||||||
if (appsService.insertApp(extendApiDetails)) {
|
if (appsService.insertApp(extendApiDetails)) {
|
||||||
return new Message<AppsExtendApiDetails>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AppsExtendApiDetails>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AppsExtendApiDetails> update(
|
||||||
public Message<?> update(
|
|
||||||
@RequestBody AppsExtendApiDetails extendApiDetails,
|
@RequestBody AppsExtendApiDetails extendApiDetails,
|
||||||
@CurrentUser UserInfo currentUser) {
|
@CurrentUser UserInfo currentUser) {
|
||||||
logger.debug("-update :" + extendApiDetails);
|
logger.debug("-update : {}" , extendApiDetails);
|
||||||
transform(extendApiDetails);
|
transform(extendApiDetails);
|
||||||
extendApiDetails.setInstId(currentUser.getInstId());
|
extendApiDetails.setInstId(currentUser.getInstId());
|
||||||
if (appsService.updateApp(extendApiDetails)) {
|
if (appsService.updateApp(extendApiDetails)) {
|
||||||
return new Message<AppsExtendApiDetails>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AppsExtendApiDetails>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AppsExtendApiDetails> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> delete(
|
|
||||||
@RequestParam("ids") List<String> ids,
|
|
||||||
@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-delete ids : {} " , ids);
|
logger.debug("-delete ids : {} " , ids);
|
||||||
if (appsService.deleteBatch(ids)) {
|
if (appsService.deleteBatch(ids)) {
|
||||||
return new Message<AppsExtendApiDetails>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AppsExtendApiDetails>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.dromara.maxkey.web.config.contorller;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.dromara.maxkey.authn.annotation.CurrentUser;
|
import org.dromara.maxkey.authn.annotation.CurrentUser;
|
||||||
import org.dromara.maxkey.entity.AccountsStrategy;
|
import org.dromara.maxkey.entity.AccountsStrategy;
|
||||||
import org.dromara.maxkey.entity.Message;
|
import org.dromara.maxkey.entity.Message;
|
||||||
@ -30,13 +31,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value={"/config/accountsstrategy"})
|
@RequestMapping(value={"/config/accountsstrategy"})
|
||||||
@ -49,69 +44,63 @@ public class AccountsStrategyController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AccountsService accountsService;
|
AccountsService accountsService;
|
||||||
|
|
||||||
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@ResponseBody
|
public Message<JpaPageResults<AccountsStrategy>> fetch(@ModelAttribute AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> fetch(@ModelAttribute AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
|
|
||||||
accountsStrategy.setInstId(currentUser.getInstId());
|
accountsStrategy.setInstId(currentUser.getInstId());
|
||||||
JpaPageResults<AccountsStrategy> accountsStrategyList =accountsStrategyService.fetchPageResults(accountsStrategy);
|
JpaPageResults<AccountsStrategy> accountsStrategyList =accountsStrategyService.fetchPageResults(accountsStrategy);
|
||||||
for (AccountsStrategy strategy : accountsStrategyList.getRows()){
|
for (AccountsStrategy strategy : accountsStrategyList.getRows()){
|
||||||
strategy.transIconBase64();
|
strategy.transIconBase64();
|
||||||
}
|
}
|
||||||
logger.debug("Accounts Strategy {}" , accountsStrategyList);
|
logger.debug("Accounts Strategy {}" , accountsStrategyList);
|
||||||
return new Message<JpaPageResults<AccountsStrategy>>(
|
return new Message<>(accountsStrategyList);
|
||||||
accountsStrategyList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@GetMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AccountsStrategy> query(@ModelAttribute AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> query(@ModelAttribute AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-query : {}" , accountsStrategy);
|
logger.debug("-query : {}" , accountsStrategy);
|
||||||
if (accountsStrategyService.query(accountsStrategy)!=null) {
|
if (CollectionUtils.isNotEmpty(accountsStrategyService.query(accountsStrategy))) {
|
||||||
return new Message<AccountsStrategy>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AccountsStrategy>(Message.SUCCESS);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> get(@PathVariable("id") String id) {
|
public Message<AccountsStrategy> get(@PathVariable("id") String id) {
|
||||||
AccountsStrategy accountsStrategy = accountsStrategyService.get(id);
|
AccountsStrategy accountsStrategy = accountsStrategyService.get(id);
|
||||||
return new Message<AccountsStrategy>(accountsStrategy);
|
return new Message<>(accountsStrategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AccountsStrategy> insert(@RequestBody AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> insert(@RequestBody AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-Add : {}" , accountsStrategy);
|
logger.debug("-Add : {}" , accountsStrategy);
|
||||||
|
|
||||||
if (accountsStrategyService.insert(accountsStrategy)) {
|
if (accountsStrategyService.insert(accountsStrategy)) {
|
||||||
accountsService.refreshByStrategy(accountsStrategy);
|
accountsService.refreshByStrategy(accountsStrategy);
|
||||||
return new Message<AccountsStrategy>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AccountsStrategy>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AccountsStrategy> update(@RequestBody AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> update(@RequestBody AccountsStrategy accountsStrategy,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-update : {}" , accountsStrategy);
|
logger.debug("-update : {}" , accountsStrategy);
|
||||||
if (accountsStrategyService.update(accountsStrategy)) {
|
if (accountsStrategyService.update(accountsStrategy)) {
|
||||||
accountsService.refreshByStrategy(accountsStrategy);
|
accountsService.refreshByStrategy(accountsStrategy);
|
||||||
return new Message<AccountsStrategy>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AccountsStrategy>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AccountsStrategy> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-delete ids : {} " , ids);
|
logger.debug("-delete ids : {} " , ids);
|
||||||
if (accountsStrategyService.deleteBatch(ids)) {
|
if (accountsStrategyService.deleteBatch(ids)) {
|
||||||
return new Message<AccountsStrategy>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AccountsStrategy>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.dromara.maxkey.web.config.contorller;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.dromara.maxkey.authn.annotation.CurrentUser;
|
import org.dromara.maxkey.authn.annotation.CurrentUser;
|
||||||
import org.dromara.maxkey.entity.Message;
|
import org.dromara.maxkey.entity.Message;
|
||||||
import org.dromara.maxkey.entity.apps.AppsAdapters;
|
import org.dromara.maxkey.entity.apps.AppsAdapters;
|
||||||
@ -29,13 +30,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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;
|
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -46,62 +41,57 @@ public class AdaptersController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppsAdaptersService appsAdaptersService;
|
AppsAdaptersService appsAdaptersService;
|
||||||
|
|
||||||
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@ResponseBody
|
public Message<JpaPageResults<AppsAdapters>> fetch(@ModelAttribute AppsAdapters appsAdapter) {
|
||||||
public Message<?> fetch(@ModelAttribute AppsAdapters appsAdapter) {
|
|
||||||
logger.debug("fetch {}",appsAdapter);
|
logger.debug("fetch {}",appsAdapter);
|
||||||
return new Message<JpaPageResults<AppsAdapters>>(
|
return new Message<>(
|
||||||
appsAdaptersService.fetchPageResults(appsAdapter));
|
appsAdaptersService.fetchPageResults(appsAdapter));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@GetMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AppsAdapters> query(@ModelAttribute AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> query(@ModelAttribute AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-query : {}" , appsAdapter);
|
logger.debug("-query : {}" , appsAdapter);
|
||||||
if (appsAdaptersService.query(appsAdapter)!=null) {
|
if (CollectionUtils.isNotEmpty(appsAdaptersService.query(appsAdapter))) {
|
||||||
return new Message<AppsAdapters>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AppsAdapters>(Message.SUCCESS);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> get(@PathVariable("id") String id) {
|
public Message<AppsAdapters> get(@PathVariable("id") String id) {
|
||||||
AppsAdapters appsAdapter=appsAdaptersService.get(id);
|
AppsAdapters appsAdapter=appsAdaptersService.get(id);
|
||||||
return new Message<AppsAdapters>(appsAdapter);
|
return new Message<>(appsAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AppsAdapters> insert(@RequestBody AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> insert(@RequestBody AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-Add : {}" , appsAdapter);
|
logger.debug("-Add : {}" , appsAdapter);
|
||||||
|
|
||||||
if (appsAdaptersService.insert(appsAdapter)) {
|
if (appsAdaptersService.insert(appsAdapter)) {
|
||||||
return new Message<AppsAdapters>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AppsAdapters>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AppsAdapters> update(@RequestBody AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> update(@RequestBody AppsAdapters appsAdapter,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-update : {}" , appsAdapter);
|
logger.debug("-update : {}" , appsAdapter);
|
||||||
if (appsAdaptersService.update(appsAdapter)) {
|
if (appsAdaptersService.update(appsAdapter)) {
|
||||||
return new Message<AppsAdapters>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AppsAdapters>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<AppsAdapters> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-delete ids : {} " , ids);
|
logger.debug("-delete ids : {} " , ids);
|
||||||
if (appsAdaptersService.deleteBatch(ids)) {
|
if (appsAdaptersService.deleteBatch(ids)) {
|
||||||
return new Message<AppsAdapters>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<AppsAdapters>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,10 +28,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value={"/config/emailsenders"})
|
@RequestMapping(value={"/config/emailsenders"})
|
||||||
@ -41,8 +38,8 @@ public class CnfEmailSendersController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
CnfEmailSendersService emailSendersService;
|
CnfEmailSendersService emailSendersService;
|
||||||
|
|
||||||
@RequestMapping(value={"/get"})
|
@GetMapping({"/get"})
|
||||||
public Message<?> get(@CurrentUser UserInfo currentUser){
|
public Message<CnfEmailSenders> get(@CurrentUser UserInfo currentUser){
|
||||||
CnfEmailSenders emailSenders = emailSendersService.get(currentUser.getInstId());
|
CnfEmailSenders emailSenders = emailSendersService.get(currentUser.getInstId());
|
||||||
if(emailSenders != null && StringUtils.isNotBlank(emailSenders.getCredentials())) {
|
if(emailSenders != null && StringUtils.isNotBlank(emailSenders.getCredentials())) {
|
||||||
emailSenders.setCredentials(PasswordReciprocal.getInstance().decoder(emailSenders.getCredentials()));
|
emailSenders.setCredentials(PasswordReciprocal.getInstance().decoder(emailSenders.getCredentials()));
|
||||||
@ -51,27 +48,26 @@ public class CnfEmailSendersController {
|
|||||||
emailSenders.setProtocol("smtp");
|
emailSenders.setProtocol("smtp");
|
||||||
emailSenders.setEncoding("utf-8");
|
emailSenders.setEncoding("utf-8");
|
||||||
}
|
}
|
||||||
return new Message<CnfEmailSenders>(emailSenders);
|
return new Message<>(emailSenders);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value={"/update"})
|
@PutMapping({"/update"})
|
||||||
@ResponseBody
|
public Message<CnfEmailSenders> update( @RequestBody CnfEmailSenders emailSenders,@CurrentUser UserInfo currentUser,BindingResult result) {
|
||||||
public Message<?> update( @RequestBody CnfEmailSenders emailSenders,@CurrentUser UserInfo currentUser,BindingResult result) {
|
|
||||||
logger.debug("update emailSenders : {}" , emailSenders);
|
logger.debug("update emailSenders : {}" , emailSenders);
|
||||||
emailSenders.setInstId(currentUser.getInstId());
|
emailSenders.setInstId(currentUser.getInstId());
|
||||||
emailSenders.setCredentials(PasswordReciprocal.getInstance().encode(emailSenders.getCredentials()));
|
emailSenders.setCredentials(PasswordReciprocal.getInstance().encode(emailSenders.getCredentials()));
|
||||||
if(StringUtils.isBlank(emailSenders.getId())) {
|
if(StringUtils.isBlank(emailSenders.getId())) {
|
||||||
emailSenders.setId(emailSenders.getInstId());
|
emailSenders.setId(emailSenders.getInstId());
|
||||||
if(emailSendersService.insert(emailSenders)) {
|
if(emailSendersService.insert(emailSenders)) {
|
||||||
return new Message<CnfEmailSenders>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
}else {
|
}else {
|
||||||
return new Message<CnfEmailSenders>(Message.ERROR);
|
return new Message<>(Message.ERROR);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(emailSendersService.update(emailSenders)) {
|
if(emailSendersService.update(emailSenders)) {
|
||||||
return new Message<CnfEmailSenders>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
}else {
|
}else {
|
||||||
return new Message<CnfEmailSenders>(Message.ERROR);
|
return new Message<>(Message.ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,10 +31,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value={"/config/ldapcontext"})
|
@RequestMapping(value={"/config/ldapcontext"})
|
||||||
@ -44,18 +41,17 @@ public class CnfLdapContextController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
CnfLdapContextService ldapContextService;
|
CnfLdapContextService ldapContextService;
|
||||||
|
|
||||||
@RequestMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> get(@CurrentUser UserInfo currentUser){
|
public Message<CnfLdapContext> get(@CurrentUser UserInfo currentUser){
|
||||||
CnfLdapContext ldapContext = ldapContextService.get(currentUser.getInstId());
|
CnfLdapContext ldapContext = ldapContextService.get(currentUser.getInstId());
|
||||||
if(ldapContext != null && StringUtils.isNoneBlank(ldapContext.getCredentials())) {
|
if(ldapContext != null && StringUtils.isNoneBlank(ldapContext.getCredentials())) {
|
||||||
ldapContext.setCredentials(PasswordReciprocal.getInstance().decoder(ldapContext.getCredentials()));
|
ldapContext.setCredentials(PasswordReciprocal.getInstance().decoder(ldapContext.getCredentials()));
|
||||||
}
|
}
|
||||||
return new Message<CnfLdapContext>(ldapContext);
|
return new Message<>(ldapContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value={"/update"})
|
@PutMapping({"/update"})
|
||||||
@ResponseBody
|
public Message<CnfLdapContext> update( @RequestBody CnfLdapContext ldapContext,@CurrentUser UserInfo currentUser,BindingResult result) {
|
||||||
public Message<?> update( @RequestBody CnfLdapContext ldapContext,@CurrentUser UserInfo currentUser,BindingResult result) {
|
|
||||||
logger.debug("update ldapContext : {}" ,ldapContext);
|
logger.debug("update ldapContext : {}" ,ldapContext);
|
||||||
ldapContext.setCredentials(PasswordReciprocal.getInstance().encode(ldapContext.getCredentials()));
|
ldapContext.setCredentials(PasswordReciprocal.getInstance().encode(ldapContext.getCredentials()));
|
||||||
ldapContext.setInstId(currentUser.getInstId());
|
ldapContext.setInstId(currentUser.getInstId());
|
||||||
@ -67,47 +63,49 @@ public class CnfLdapContextController {
|
|||||||
updateResult = ldapContextService.update(ldapContext);
|
updateResult = ldapContextService.update(ldapContext);
|
||||||
}
|
}
|
||||||
if(updateResult) {
|
if(updateResult) {
|
||||||
return new Message<CnfLdapContext>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<CnfLdapContext>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value={"/test"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value={"/test"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> test(@CurrentUser UserInfo currentUser){
|
public Message<CnfLdapContext> test(@CurrentUser UserInfo currentUser){
|
||||||
CnfLdapContext ldapContext = ldapContextService.get(currentUser.getInstId());
|
CnfLdapContext ldapContext = ldapContextService.get(currentUser.getInstId());
|
||||||
if(ldapContext != null && StringUtils.isNoneBlank(ldapContext.getCredentials())) {
|
if(ldapContext != null && StringUtils.isNoneBlank(ldapContext.getCredentials())) {
|
||||||
ldapContext.setCredentials(PasswordReciprocal.getInstance().decoder(ldapContext.getCredentials()));
|
ldapContext.setCredentials(PasswordReciprocal.getInstance().decoder(ldapContext.getCredentials()));
|
||||||
}
|
}
|
||||||
|
|
||||||
LdapUtils ldapUtils = null;
|
LdapUtils ldapUtils = null;
|
||||||
if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.ActiveDirectory)) {
|
if(ldapContext != null) {
|
||||||
ldapUtils = new ActiveDirectoryUtils(
|
if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.ActiveDirectory)) {
|
||||||
ldapContext.getProviderUrl(),
|
ldapUtils = new ActiveDirectoryUtils(
|
||||||
ldapContext.getPrincipal(),
|
ldapContext.getProviderUrl(),
|
||||||
ldapContext.getCredentials(),
|
ldapContext.getPrincipal(),
|
||||||
ldapContext.getBasedn(),
|
ldapContext.getCredentials(),
|
||||||
ldapContext.getMsadDomain());
|
ldapContext.getBasedn(),
|
||||||
}else if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.OpenLDAP)) {
|
ldapContext.getMsadDomain());
|
||||||
ldapUtils = new LdapUtils(
|
}else if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.OpenLDAP)) {
|
||||||
ldapContext.getProviderUrl(),
|
ldapUtils = new LdapUtils(
|
||||||
ldapContext.getPrincipal(),
|
ldapContext.getProviderUrl(),
|
||||||
ldapContext.getCredentials(),
|
ldapContext.getPrincipal(),
|
||||||
ldapContext.getBasedn());
|
ldapContext.getCredentials(),
|
||||||
}else if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.StandardLDAP)) {
|
ldapContext.getBasedn());
|
||||||
ldapUtils = new LdapUtils(
|
}else if(ldapContext.getProduct().equalsIgnoreCase(LdapUtils.Product.StandardLDAP)) {
|
||||||
ldapContext.getProviderUrl(),
|
ldapUtils = new LdapUtils(
|
||||||
ldapContext.getPrincipal(),
|
ldapContext.getProviderUrl(),
|
||||||
ldapContext.getCredentials(),
|
ldapContext.getPrincipal(),
|
||||||
ldapContext.getBasedn());
|
ldapContext.getCredentials(),
|
||||||
|
ldapContext.getBasedn());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ldapUtils != null && ldapUtils.openConnection() != null) {
|
||||||
|
ldapUtils.close();
|
||||||
|
return new Message<>(Message.SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ldapUtils.openConnection() != null) {
|
return new Message<>(Message.FAIL);
|
||||||
ldapUtils.close();
|
|
||||||
return new Message<CnfLdapContext>(Message.SUCCESS);
|
|
||||||
}else {
|
|
||||||
return new Message<CnfLdapContext>(Message.FAIL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,10 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.validation.FieldError;
|
import org.springframework.validation.FieldError;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -43,21 +40,21 @@ public class CnfPasswordPolicyController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
CnfPasswordPolicyService passwordPolicyService;
|
CnfPasswordPolicyService passwordPolicyService;
|
||||||
|
|
||||||
@RequestMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> get(@CurrentUser UserInfo currentUser){
|
public Message<CnfPasswordPolicy> get(@CurrentUser UserInfo currentUser){
|
||||||
CnfPasswordPolicy passwordPolicy = passwordPolicyService.get(currentUser.getInstId());
|
CnfPasswordPolicy passwordPolicy = passwordPolicyService.get(currentUser.getInstId());
|
||||||
return new Message<CnfPasswordPolicy>(passwordPolicy);
|
return new Message<>(passwordPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> update(@Valid @RequestBody CnfPasswordPolicy passwordPolicy,@CurrentUser UserInfo currentUser,BindingResult result) {
|
public Message<CnfPasswordPolicy> update(@Valid @RequestBody CnfPasswordPolicy passwordPolicy,@CurrentUser UserInfo currentUser,BindingResult result) {
|
||||||
logger.debug("updateRole passwordPolicy : {}" ,passwordPolicy);
|
logger.debug("updateRole passwordPolicy : {}" ,passwordPolicy);
|
||||||
//Message message = this.validate(result, passwordPolicy);
|
//Message message = this.validate(result, passwordPolicy);
|
||||||
|
|
||||||
if(passwordPolicyService.update(passwordPolicy)) {
|
if(passwordPolicyService.update(passwordPolicy)) {
|
||||||
return new Message<CnfPasswordPolicy>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<CnfPasswordPolicy>(Message.ERROR);
|
return new Message<>(Message.ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,10 +29,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value={"/config/smsprovider"})
|
@RequestMapping(value={"/config/smsprovider"})
|
||||||
@ -42,18 +39,17 @@ public class CnfSmsProviderController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
CnfSmsProviderService smsProviderService;
|
CnfSmsProviderService smsProviderService;
|
||||||
|
|
||||||
@RequestMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value={"/get"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> get(@CurrentUser UserInfo currentUser){
|
public Message<CnfSmsProvider> get(@CurrentUser UserInfo currentUser){
|
||||||
CnfSmsProvider smsProvider = smsProviderService.get(currentUser.getInstId());
|
CnfSmsProvider smsProvider = smsProviderService.get(currentUser.getInstId());
|
||||||
if(smsProvider != null && StringUtils.isNoneBlank(smsProvider.getId())) {
|
if(smsProvider != null && StringUtils.isNoneBlank(smsProvider.getId())) {
|
||||||
smsProvider.setAppSecret(PasswordReciprocal.getInstance().decoder(smsProvider.getAppSecret()));
|
smsProvider.setAppSecret(PasswordReciprocal.getInstance().decoder(smsProvider.getAppSecret()));
|
||||||
}
|
}
|
||||||
return new Message<CnfSmsProvider>(smsProvider);
|
return new Message<>(smsProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value={"/update"})
|
@PutMapping({"/update"})
|
||||||
@ResponseBody
|
public Message<CnfSmsProvider> update( @RequestBody CnfSmsProvider smsProvider,@CurrentUser UserInfo currentUser,BindingResult result) {
|
||||||
public Message<?> update( @RequestBody CnfSmsProvider smsProvider,@CurrentUser UserInfo currentUser,BindingResult result) {
|
|
||||||
logger.debug("update smsProvider : {}" ,smsProvider);
|
logger.debug("update smsProvider : {}" ,smsProvider);
|
||||||
smsProvider.setAppSecret(PasswordReciprocal.getInstance().encode(smsProvider.getAppSecret()));
|
smsProvider.setAppSecret(PasswordReciprocal.getInstance().encode(smsProvider.getAppSecret()));
|
||||||
smsProvider.setInstId(currentUser.getInstId());
|
smsProvider.setInstId(currentUser.getInstId());
|
||||||
@ -65,9 +61,9 @@ public class CnfSmsProviderController {
|
|||||||
updateResult = smsProviderService.update(smsProvider);
|
updateResult = smsProviderService.update(smsProvider);
|
||||||
}
|
}
|
||||||
if(updateResult) {
|
if(updateResult) {
|
||||||
return new Message<CnfSmsProvider>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<CnfSmsProvider>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,12 +31,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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
|
@RestController
|
||||||
@RequestMapping(value={"/config/connectors"})
|
@RequestMapping(value={"/config/connectors"})
|
||||||
@ -46,60 +41,55 @@ public class ConnectorsController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
ConnectorsService connectorsService;
|
ConnectorsService connectorsService;
|
||||||
|
|
||||||
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@ResponseBody
|
public Message<JpaPageResults<Connectors>> fetch(Connectors connector,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> fetch(Connectors connector,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("fetch {}" , connector);
|
logger.debug("fetch {}" , connector);
|
||||||
connector.setInstId(currentUser.getInstId());
|
connector.setInstId(currentUser.getInstId());
|
||||||
return new Message<JpaPageResults<Connectors>>(
|
return new Message<>(connectorsService.fetchPageResults(connector));
|
||||||
connectorsService.fetchPageResults(connector));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> get(@PathVariable("id") String id) {
|
public Message<Connectors> get(@PathVariable("id") String id) {
|
||||||
Connectors connector = connectorsService.get(id);
|
Connectors connector = connectorsService.get(id);
|
||||||
if(StringUtils.isNotBlank(connector.getCredentials())) {
|
if(StringUtils.isNotBlank(connector.getCredentials())) {
|
||||||
connector.setCredentials(PasswordReciprocal.getInstance().decoder(connector.getCredentials()));
|
connector.setCredentials(PasswordReciprocal.getInstance().decoder(connector.getCredentials()));
|
||||||
}
|
}
|
||||||
return new Message<Connectors>(connector);
|
return new Message<>(connector);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Connectors> insert(@RequestBody Connectors connector,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> insert(@RequestBody Connectors connector,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-Add : {}" , connector);
|
logger.debug("-Add : {}" , connector);
|
||||||
connector.setInstId(currentUser.getInstId());
|
connector.setInstId(currentUser.getInstId());
|
||||||
if(StringUtils.isNotBlank(connector.getCredentials())) {
|
if(StringUtils.isNotBlank(connector.getCredentials())) {
|
||||||
connector.setCredentials(PasswordReciprocal.getInstance().encode(connector.getCredentials()));
|
connector.setCredentials(PasswordReciprocal.getInstance().encode(connector.getCredentials()));
|
||||||
}
|
}
|
||||||
if (connectorsService.insert(connector)) {
|
if (connectorsService.insert(connector)) {
|
||||||
return new Message<Connectors>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Connectors>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Connectors> update(@RequestBody Connectors connector,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> update(@RequestBody Connectors connector,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-update : {}" , connector);
|
logger.debug("-update : {}" , connector);
|
||||||
connector.setInstId(currentUser.getInstId());
|
connector.setInstId(currentUser.getInstId());
|
||||||
connector.setCredentials(PasswordReciprocal.getInstance().encode(connector.getCredentials()));
|
connector.setCredentials(PasswordReciprocal.getInstance().encode(connector.getCredentials()));
|
||||||
if (connectorsService.update(connector)) {
|
if (connectorsService.update(connector)) {
|
||||||
return new Message<Connectors>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Connectors>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Connectors> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
|
||||||
logger.debug("-delete ids : {} " , ids);
|
logger.debug("-delete ids : {} " , ids);
|
||||||
if (connectorsService.deleteBatch(ids)) {
|
if (connectorsService.deleteBatch(ids)) {
|
||||||
return new Message<Connectors>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Connectors>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.dromara.maxkey.web.contorller;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.dromara.maxkey.authn.annotation.CurrentUser;
|
import org.dromara.maxkey.authn.annotation.CurrentUser;
|
||||||
import org.dromara.maxkey.constants.ConstsEntryType;
|
import org.dromara.maxkey.constants.ConstsEntryType;
|
||||||
import org.dromara.maxkey.constants.ConstsAct;
|
import org.dromara.maxkey.constants.ConstsAct;
|
||||||
@ -38,12 +39,15 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
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.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
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;
|
||||||
|
|
||||||
|
|
||||||
@ -67,37 +71,34 @@ public class AccountsController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
HistorySystemLogsService systemLog;
|
HistorySystemLogsService systemLog;
|
||||||
|
|
||||||
@RequestMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/fetch" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@ResponseBody
|
public Message<JpaPageResults<Accounts>> fetch(@ModelAttribute Accounts accounts,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> fetch(@ModelAttribute Accounts accounts,@CurrentUser UserInfo currentUser) {
|
|
||||||
_logger.debug("fetch {}" , accounts);
|
_logger.debug("fetch {}" , accounts);
|
||||||
accounts.setInstId(currentUser.getInstId());
|
accounts.setInstId(currentUser.getInstId());
|
||||||
return new Message<JpaPageResults<Accounts>>(
|
return new Message<>(
|
||||||
accountsService.fetchPageResults(accounts));
|
accountsService.fetchPageResults(accounts));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@GetMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/query"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Accounts> query(@ModelAttribute Accounts account,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> query(@ModelAttribute Accounts account,@CurrentUser UserInfo currentUser) {
|
|
||||||
_logger.debug("-query : {}" , account);
|
_logger.debug("-query : {}" , account);
|
||||||
account.setInstId(currentUser.getInstId());
|
account.setInstId(currentUser.getInstId());
|
||||||
if (accountsService.query(account)!=null) {
|
if (CollectionUtils.isNotEmpty(accountsService.query(account))) {
|
||||||
return new Message<Accounts>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Accounts>(Message.SUCCESS);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/get/{id}" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public Message<?> get(@PathVariable("id") String id) {
|
public Message<Accounts> get(@PathVariable("id") String id) {
|
||||||
Accounts account=accountsService.get(id);
|
Accounts account=accountsService.get(id);
|
||||||
account.setRelatedPassword(PasswordReciprocal.getInstance().decoder(account.getRelatedPassword()));
|
account.setRelatedPassword(PasswordReciprocal.getInstance().decoder(account.getRelatedPassword()));
|
||||||
return new Message<Accounts>(account);
|
return new Message<>(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PostMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Accounts> insert(@RequestBody Accounts account,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> insert(@RequestBody Accounts account,@CurrentUser UserInfo currentUser) {
|
|
||||||
_logger.debug("-Add : {}" , account);
|
_logger.debug("-Add : {}" , account);
|
||||||
account.setInstId(currentUser.getInstId());
|
account.setInstId(currentUser.getInstId());
|
||||||
account.setRelatedPassword(PasswordReciprocal.getInstance().encode(account.getRelatedPassword()));
|
account.setRelatedPassword(PasswordReciprocal.getInstance().encode(account.getRelatedPassword()));
|
||||||
@ -108,15 +109,14 @@ public class AccountsController {
|
|||||||
ConstsAct.CREATE,
|
ConstsAct.CREATE,
|
||||||
ConstsActResult.SUCCESS,
|
ConstsActResult.SUCCESS,
|
||||||
currentUser);
|
currentUser);
|
||||||
return new Message<Accounts>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Accounts>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Accounts> update(@RequestBody Accounts account,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> update(@RequestBody Accounts account,@CurrentUser UserInfo currentUser) {
|
|
||||||
_logger.debug("-update : {}" , account);
|
_logger.debug("-update : {}" , account);
|
||||||
account.setInstId(currentUser.getInstId());
|
account.setInstId(currentUser.getInstId());
|
||||||
account.setRelatedPassword(PasswordReciprocal.getInstance().encode(account.getRelatedPassword()));
|
account.setRelatedPassword(PasswordReciprocal.getInstance().encode(account.getRelatedPassword()));
|
||||||
@ -127,16 +127,15 @@ public class AccountsController {
|
|||||||
ConstsAct.UPDATE,
|
ConstsAct.UPDATE,
|
||||||
ConstsActResult.SUCCESS,
|
ConstsActResult.SUCCESS,
|
||||||
currentUser);
|
currentUser);
|
||||||
return new Message<Accounts>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Accounts>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = { "/updateStatus" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
@GetMapping(value = { "/updateStatus" }, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@ResponseBody
|
public Message<Accounts> updateStatus(@ModelAttribute Accounts accounts,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> updateStatus(@ModelAttribute Accounts accounts,@CurrentUser UserInfo currentUser) {
|
|
||||||
_logger.debug("accounts : {}" , accounts);
|
_logger.debug("accounts : {}" , accounts);
|
||||||
Accounts loadAccount = accountsService.get(accounts.getId());
|
Accounts loadAccount = accountsService.get(accounts.getId());
|
||||||
accounts.setInstId(currentUser.getInstId());
|
accounts.setInstId(currentUser.getInstId());
|
||||||
@ -153,15 +152,14 @@ public class AccountsController {
|
|||||||
ConstsAct.statusActon.get(accounts.getStatus()),
|
ConstsAct.statusActon.get(accounts.getStatus()),
|
||||||
ConstsActResult.SUCCESS,
|
ConstsActResult.SUCCESS,
|
||||||
currentUser);
|
currentUser);
|
||||||
return new Message<Accounts>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Accounts>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@DeleteMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
public Message<Accounts> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
||||||
public Message<?> delete(@RequestParam("ids") List<String> ids,@CurrentUser UserInfo currentUser) {
|
|
||||||
_logger.debug("-delete ids : {} " , ids);
|
_logger.debug("-delete ids : {} " , ids);
|
||||||
|
|
||||||
if (accountsService.deleteBatch(ids)) {
|
if (accountsService.deleteBatch(ids)) {
|
||||||
@ -171,21 +169,19 @@ public class AccountsController {
|
|||||||
ConstsAct.DELETE,
|
ConstsAct.DELETE,
|
||||||
ConstsActResult.SUCCESS,
|
ConstsActResult.SUCCESS,
|
||||||
currentUser);
|
currentUser);
|
||||||
return new Message<Accounts>(Message.SUCCESS);
|
return new Message<>(Message.SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
return new Message<Accounts>(Message.FAIL);
|
return new Message<>(Message.FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@GetMapping(value = "/generate")
|
||||||
@RequestMapping(value = "/generate")
|
public Message<String> generate(@ModelAttribute Accounts account) {
|
||||||
public Message<?> generate(@ModelAttribute Accounts account) {
|
|
||||||
AccountsStrategy accountsStrategy = accountsStrategyService.get(account.getStrategyId());
|
AccountsStrategy accountsStrategy = accountsStrategyService.get(account.getStrategyId());
|
||||||
UserInfo userInfo = userInfoService.get(account.getUserId());
|
UserInfo userInfo = userInfoService.get(account.getUserId());
|
||||||
return new Message<Object>(
|
return new Message<>(
|
||||||
Message.SUCCESS,
|
Message.SUCCESS,accountsService.generateAccount(userInfo,accountsStrategy)
|
||||||
(Object)accountsService.generateAccount(userInfo,accountsStrategy)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -228,7 +228,7 @@ springdoc.group-configs[0].paths-to-match =/*
|
|||||||
springdoc.group-configs[0].packages-to-scan =org.dromara.maxkey
|
springdoc.group-configs[0].packages-to-scan =org.dromara.maxkey
|
||||||
|
|
||||||
knife4j.enable =true
|
knife4j.enable =true
|
||||||
knife4j.setting.language =zh_cn
|
knife4j.setting.language =ZH_CN
|
||||||
knife4j.setting.swagger-model-name =\u5B9E\u4F53\u7C7B\u5217\u8868
|
knife4j.setting.swagger-model-name =\u5B9E\u4F53\u7C7B\u5217\u8868
|
||||||
############################################################################
|
############################################################################
|
||||||
#freemarker configuration #
|
#freemarker configuration #
|
||||||
|
|||||||
@ -228,7 +228,7 @@ springdoc.group-configs[0].paths-to-match =/*
|
|||||||
springdoc.group-configs[0].packages-to-scan =org.dromara.maxkey
|
springdoc.group-configs[0].packages-to-scan =org.dromara.maxkey
|
||||||
|
|
||||||
knife4j.enable =true
|
knife4j.enable =true
|
||||||
knife4j.setting.language =zh_cn
|
knife4j.setting.language =ZH_CN
|
||||||
knife4j.setting.swagger-model-name =\u5B9E\u4F53\u7C7B\u5217\u8868
|
knife4j.setting.swagger-model-name =\u5B9E\u4F53\u7C7B\u5217\u8868
|
||||||
############################################################################
|
############################################################################
|
||||||
#freemarker configuration #
|
#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
@ -2,7 +2,7 @@
|
|||||||
--
|
--
|
||||||
-- Host: 127.0.0.1 Database: maxkey
|
-- 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_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
/*!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' */;
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
/*!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`
|
-- Table structure for table `mxk_accounts`
|
||||||
--
|
--
|
||||||
@ -265,6 +283,125 @@ CREATE TABLE `mxk_apps_token_based_details` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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`
|
-- Table structure for table `mxk_connectors`
|
||||||
--
|
--
|
||||||
@ -294,34 +431,6 @@ CREATE TABLE `mxk_connectors` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='连接器';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='连接器';
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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`
|
-- 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',
|
`MEMBERID` varchar(100) NOT NULL COMMENT 'MEMBERID USERID OR GROUP ID',
|
||||||
`TYPE` varchar(45) NOT NULL COMMENT 'TYPE USER OR GROUP',
|
`TYPE` varchar(45) NOT NULL COMMENT 'TYPE USER OR GROUP',
|
||||||
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
|
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
|
||||||
`INSTID` varchar(45) NOT NULL
|
`INSTID` varchar(45) NOT NULL,
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
PRIMARY KEY (`ID`),
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
UNIQUE KEY `GROUPID_MEMBERID` (`GROUPID`,`MEMBERID`,`TYPE`)
|
||||||
|
|
||||||
--
|
|
||||||
-- 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
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='institutions机构表,存放租户信息multi-tenancy';
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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`
|
-- Table structure for table `mxk_localization`
|
||||||
--
|
--
|
||||||
@ -746,36 +791,42 @@ CREATE TABLE `mxk_organizations_cast` (
|
|||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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 */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!50503 SET character_set_client = utf8mb4 */;
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
CREATE TABLE `mxk_password_policy` (
|
CREATE TABLE `mxk_permission` (
|
||||||
`ID` varchar(45) NOT NULL,
|
`id` varchar(50) NOT NULL,
|
||||||
`MINLENGTH` tinyint unsigned DEFAULT '0' COMMENT 'MINLENGTH',
|
`appid` varchar(50) DEFAULT NULL,
|
||||||
`MAXLENGTH` tinyint unsigned DEFAULT '0' COMMENT 'MAXLENGTH',
|
`groupid` varchar(50) DEFAULT NULL,
|
||||||
`LOWERCASE` tinyint unsigned DEFAULT '0' COMMENT 'LOWERCASE',
|
`resourceid` varchar(50) DEFAULT NULL,
|
||||||
`UPPERCASE` tinyint unsigned DEFAULT '0' COMMENT 'UPPERCASE',
|
`CREATEDBY` varchar(45) DEFAULT NULL,
|
||||||
`DIGITS` tinyint unsigned DEFAULT '0' COMMENT 'DIGITS',
|
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
|
||||||
`SPECIALCHAR` tinyint unsigned DEFAULT '0' COMMENT 'SPECIALCHAR',
|
`status` int DEFAULT '1',
|
||||||
`ATTEMPTS` tinyint unsigned DEFAULT '0' COMMENT 'ATTEMPTS LOGIN FOR LOCK',
|
`INSTID` varchar(45) DEFAULT NULL
|
||||||
`DURATION` tinyint unsigned DEFAULT '0' COMMENT 'DURATION ',
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
||||||
`EXPIRATION` tinyint unsigned DEFAULT '0' COMMENT 'PASSWORD EXPIRATION',
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
`USERNAME` tinyint unsigned DEFAULT '0' COMMENT 'USERNAME IN PASSWORD',
|
|
||||||
`HISTORY` tinyint DEFAULT '0' COMMENT 'SIMPLEPASSWORDS NOT USE FOR PASSWORD',
|
--
|
||||||
`DICTIONARY` tinyint DEFAULT NULL,
|
-- Table structure for table `mxk_permission_role`
|
||||||
`ALPHABETICAL` tinyint DEFAULT NULL,
|
--
|
||||||
`NUMERICAL` tinyint DEFAULT NULL,
|
|
||||||
`QWERTY` tinyint DEFAULT NULL,
|
DROP TABLE IF EXISTS `mxk_permission_role`;
|
||||||
`OCCURANCES` tinyint DEFAULT NULL,
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
`CREATEDBY` varchar(45) DEFAULT NULL COMMENT 'CREATEDBY',
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'CREATEDDATE',
|
CREATE TABLE `mxk_permission_role` (
|
||||||
`MODIFIEDBY` varchar(45) DEFAULT NULL COMMENT 'MODIFIEDBY',
|
`id` varchar(50) NOT NULL,
|
||||||
`MODIFIEDDATE` datetime DEFAULT NULL COMMENT 'MODIFIEDDATE',
|
`appid` varchar(50) DEFAULT NULL,
|
||||||
PRIMARY KEY (`ID`)
|
`roleid` varchar(50) DEFAULT NULL,
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='password policy';
|
`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 */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -864,49 +915,10 @@ CREATE TABLE `mxk_role_member` (
|
|||||||
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
|
`CREATEDDATE` datetime DEFAULT CURRENT_TIMESTAMP,
|
||||||
`INSTID` varchar(45) NOT NULL,
|
`INSTID` varchar(45) NOT NULL,
|
||||||
PRIMARY KEY (`ID`),
|
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';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='group member,USERS OR GROUPS';
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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`
|
-- Table structure for table `mxk_roles`
|
||||||
--
|
--
|
||||||
@ -931,37 +943,11 @@ CREATE TABLE `mxk_roles` (
|
|||||||
`MODIFIEDDATE` datetime DEFAULT NULL COMMENT 'MODIFIEDDATE',
|
`MODIFIEDDATE` datetime DEFAULT NULL COMMENT 'MODIFIEDDATE',
|
||||||
`DESCRIPTION` varchar(500) DEFAULT NULL COMMENT 'DESCRIPTION',
|
`DESCRIPTION` varchar(500) DEFAULT NULL COMMENT 'DESCRIPTION',
|
||||||
`INSTID` varchar(45) NOT NULL,
|
`INSTID` varchar(45) NOT NULL,
|
||||||
|
`APPID` varchar(45) DEFAULT NULL,
|
||||||
PRIMARY KEY (`ID`)
|
PRIMARY KEY (`ID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='groups';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='groups';
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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`
|
-- Table structure for table `mxk_socials_associate`
|
||||||
--
|
--
|
||||||
@ -1198,47 +1184,29 @@ CREATE TABLE `mxk_userinfo` (
|
|||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!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 */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!50503 SET character_set_client = utf8mb4 */;
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
CREATE TABLE `mxk_userinfo_adjunct` (
|
CREATE TABLE `sync_job_config_field` (
|
||||||
`ID` varchar(45) NOT NULL COMMENT '编号',
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`USERID` varchar(45) NOT NULL COMMENT '用户编号',
|
`jobid` bigint NOT NULL DEFAULT '0' COMMENT '同步任务ID',
|
||||||
`ORGANIZATION` varchar(45) DEFAULT NULL COMMENT '机构',
|
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '规则名',
|
||||||
`DEPARTMENTID` varchar(45) DEFAULT NULL COMMENT '部门编号',
|
`objecttype` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '类型',
|
||||||
`DEPARTMENT` varchar(45) DEFAULT NULL COMMENT '部门',
|
`targetfield` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '目标字段',
|
||||||
`JOBTITLE` varchar(45) DEFAULT NULL COMMENT '职务',
|
`targetfieldname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '目标字段描述',
|
||||||
`JOBLEVEL` varchar(45) DEFAULT NULL COMMENT '工作职级',
|
`sourcefield` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '来源字段',
|
||||||
`MANAGERID` varchar(45) DEFAULT NULL COMMENT '经理编号',
|
`sourcefieldname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '来源字段描述',
|
||||||
`MANAGER` varchar(45) DEFAULT NULL COMMENT '经理名字',
|
`description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '描述',
|
||||||
`ASSISTANTID` varchar(45) DEFAULT NULL COMMENT '助理编号',
|
`createuser` bigint DEFAULT '0' COMMENT '创建人',
|
||||||
`ASSISTANT` varchar(45) DEFAULT NULL COMMENT '助理名字',
|
`createtime` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
`ENTRYDATE` varchar(45) DEFAULT NULL COMMENT '入司时间',
|
`updateuser` bigint DEFAULT '0' COMMENT '修改人',
|
||||||
`STARTWORKDATE` varchar(45) DEFAULT NULL COMMENT '开始工作时间',
|
`updatetime` datetime DEFAULT NULL COMMENT '修改时间',
|
||||||
`QUITDATE` varchar(45) DEFAULT NULL COMMENT '离职日期',
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
`SORTORDER` tinyint unsigned DEFAULT '0' COMMENT '部门内排序',
|
KEY `idx_job_id` (`jobid`) USING BTREE COMMENT '同步任务ID索引'
|
||||||
`WORKEMAIL` varchar(45) DEFAULT NULL COMMENT '工作-邮件',
|
) ENGINE=InnoDB AUTO_INCREMENT=214 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC 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';
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||||
|
|
||||||
@ -1250,4 +1218,4 @@ CREATE TABLE `mxk_userinfo_adjunct` (
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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
Loading…
x
Reference in New Issue
Block a user