代码整合优化

This commit is contained in:
shimingxy
2024-12-18 10:47:35 +08:00
parent f19e92e2dc
commit 7844fc25bf
30 changed files with 592 additions and 707 deletions
@@ -43,9 +43,9 @@ import org.dromara.maxkey.password.onetimepwd.impl.TimeBasedOtpAuthn;
import org.dromara.maxkey.password.onetimepwd.token.RedisOtpTokenStore;
import org.dromara.maxkey.persistence.redis.RedisConnectionFactory;
import org.dromara.maxkey.persistence.repository.LoginRepository;
import org.dromara.maxkey.persistence.repository.PasswordPolicyValidator;
import org.dromara.maxkey.persistence.service.CnfLdapContextService;
import org.dromara.maxkey.persistence.service.HistoryLoginService;
import org.dromara.maxkey.persistence.service.PasswordPolicyValidatorService;
import org.dromara.maxkey.persistence.service.UserInfoService;
import org.dromara.maxkey.schedule.ScheduleAdapterBuilder;
import org.quartz.Scheduler;
@@ -88,7 +88,7 @@ public class MaxKeyConfig {
@Bean
JdbcAuthenticationRealm authenticationRealm(
@Qualifier("passwordEncoder") PasswordEncoder passwordEncoder,
PasswordPolicyValidator passwordPolicyValidator,
PasswordPolicyValidatorService passwordPolicyValidatorService,
LoginRepository loginService,
HistoryLoginService historyLoginService,
UserInfoService userInfoService,
@@ -99,7 +99,7 @@ public class MaxKeyConfig {
LdapAuthenticationRealmService ldapRealmService = new LdapAuthenticationRealmService(ldapContextService);
return new JdbcAuthenticationRealm(
passwordEncoder,
passwordPolicyValidator,
passwordPolicyValidatorService,
loginService,
historyLoginService,
userInfoService,
@@ -26,10 +26,10 @@ import org.dromara.maxkey.entity.ChangePassword;
import org.dromara.maxkey.entity.Message;
import org.dromara.maxkey.entity.cnf.CnfPasswordPolicy;
import org.dromara.maxkey.entity.idm.UserInfo;
import org.dromara.maxkey.persistence.repository.PasswordPolicyValidator;
import org.dromara.maxkey.persistence.service.HistorySystemLogsService;
import org.dromara.maxkey.persistence.service.CnfPasswordPolicyService;
import org.dromara.maxkey.persistence.service.UserInfoService;
import org.dromara.maxkey.persistence.service.impl.PasswordPolicyValidatorServiceImpl;
import org.dromara.maxkey.web.WebContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,7 +78,7 @@ public class ChangePasswodController {
currentUser);
return new Message<>();
}else {
String message = (String) WebContext.getAttribute(PasswordPolicyValidator.PASSWORD_POLICY_VALIDATE_RESULT);
String message = (String) WebContext.getAttribute(PasswordPolicyValidatorServiceImpl.PASSWORD_POLICY_VALIDATE_RESULT);
logger.info("-message: {}",message);
return new Message<>(Message.ERROR,message);
}
@@ -22,8 +22,8 @@ import org.dromara.maxkey.ip2location.IpLocationParser;
import org.dromara.maxkey.password.onetimepwd.AbstractOtpAuthn;
import org.dromara.maxkey.password.onetimepwd.impl.TimeBasedOtpAuthn;
import org.dromara.maxkey.persistence.repository.LoginRepository;
import org.dromara.maxkey.persistence.repository.PasswordPolicyValidator;
import org.dromara.maxkey.persistence.service.HistoryLoginService;
import org.dromara.maxkey.persistence.service.PasswordPolicyValidatorService;
import org.dromara.maxkey.persistence.service.UserInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +42,7 @@ public class MaxKeyMgtConfig {
JdbcAuthenticationRealm authenticationRealm(
@Qualifier("passwordEncoder")
PasswordEncoder passwordEncoder,
PasswordPolicyValidator passwordPolicyValidator,
PasswordPolicyValidatorService passwordPolicyValidatorService,
LoginRepository loginRepository,
HistoryLoginService historyLoginService,
UserInfoService userInfoService,
@@ -51,7 +51,7 @@ public class MaxKeyMgtConfig {
JdbcAuthenticationRealm authenticationRealm = new JdbcAuthenticationRealm(
passwordEncoder,
passwordPolicyValidator,
passwordPolicyValidatorService,
loginRepository,
historyLoginService,
userInfoService,
@@ -22,8 +22,8 @@ import org.dromara.maxkey.ip2location.IpLocationParser;
import org.dromara.maxkey.password.onetimepwd.AbstractOtpAuthn;
import org.dromara.maxkey.password.onetimepwd.impl.TimeBasedOtpAuthn;
import org.dromara.maxkey.persistence.repository.LoginRepository;
import org.dromara.maxkey.persistence.repository.PasswordPolicyValidator;
import org.dromara.maxkey.persistence.service.HistoryLoginService;
import org.dromara.maxkey.persistence.service.PasswordPolicyValidatorService;
import org.dromara.maxkey.persistence.service.UserInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +42,7 @@ public class MaxKeyOpenApiConfig{
JdbcAuthenticationRealm authenticationRealm(
@Qualifier("passwordEncoder")
PasswordEncoder passwordEncoder,
PasswordPolicyValidator passwordPolicyValidator,
PasswordPolicyValidatorService passwordPolicyValidatorService,
LoginRepository loginRepository,
HistoryLoginService historyLoginService,
UserInfoService userInfoService,
@@ -51,7 +51,7 @@ public class MaxKeyOpenApiConfig{
JdbcAuthenticationRealm authenticationRealm = new JdbcAuthenticationRealm(
passwordEncoder,
passwordPolicyValidator,
passwordPolicyValidatorService,
loginRepository,
historyLoginService,
userInfoService,