整合LoginHistoryRepository 到 HistoryLoginService
This commit is contained in:
@@ -28,9 +28,9 @@ import org.dromara.maxkey.entity.idm.Groups;
|
||||
import org.dromara.maxkey.entity.idm.UserInfo;
|
||||
import org.dromara.maxkey.ip2location.IpLocationParser;
|
||||
import org.dromara.maxkey.ip2location.Region;
|
||||
import org.dromara.maxkey.persistence.repository.LoginHistoryRepository;
|
||||
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.UserInfoService;
|
||||
import org.dromara.maxkey.web.WebConstants;
|
||||
import org.dromara.maxkey.web.WebContext;
|
||||
@@ -54,7 +54,7 @@ public abstract class AbstractAuthenticationRealm {
|
||||
|
||||
protected LoginRepository loginRepository;
|
||||
|
||||
protected LoginHistoryRepository loginHistoryRepository;
|
||||
protected HistoryLoginService historyLoginService;
|
||||
|
||||
protected UserInfoService userInfoService;
|
||||
|
||||
@@ -158,7 +158,7 @@ public abstract class AbstractAuthenticationRealm {
|
||||
historyLogin.setCity(ipRegion.getCity());
|
||||
historyLogin.setLocation(ipRegion.getAddr());
|
||||
}
|
||||
loginHistoryRepository.login(historyLogin);
|
||||
historyLoginService.login(historyLogin);
|
||||
|
||||
loginRepository.updateLastLogin(userInfo);
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ import org.dromara.maxkey.entity.ChangePassword;
|
||||
import org.dromara.maxkey.entity.cnf.CnfPasswordPolicy;
|
||||
import org.dromara.maxkey.entity.idm.UserInfo;
|
||||
import org.dromara.maxkey.ip2location.IpLocationParser;
|
||||
import org.dromara.maxkey.persistence.repository.LoginHistoryRepository;
|
||||
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.UserInfoService;
|
||||
import org.dromara.maxkey.web.WebConstants;
|
||||
import org.dromara.maxkey.web.WebContext;
|
||||
@@ -60,7 +60,7 @@ public class JdbcAuthenticationRealm extends AbstractAuthenticationRealm {
|
||||
PasswordEncoder passwordEncoder,
|
||||
PasswordPolicyValidator passwordPolicyValidator,
|
||||
LoginRepository loginRepository,
|
||||
LoginHistoryRepository loginHistoryRepository,
|
||||
HistoryLoginService historyLoginService,
|
||||
UserInfoService userInfoService,
|
||||
IpLocationParser ipLocationParser,
|
||||
JdbcTemplate jdbcTemplate) {
|
||||
@@ -68,7 +68,7 @@ public class JdbcAuthenticationRealm extends AbstractAuthenticationRealm {
|
||||
this.passwordEncoder =passwordEncoder;
|
||||
this.passwordPolicyValidator=passwordPolicyValidator;
|
||||
this.loginRepository = loginRepository;
|
||||
this.loginHistoryRepository = loginHistoryRepository;
|
||||
this.historyLoginService = historyLoginService;
|
||||
this.userInfoService = userInfoService;
|
||||
this.ipLocationParser = ipLocationParser;
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
@@ -78,7 +78,7 @@ public class JdbcAuthenticationRealm extends AbstractAuthenticationRealm {
|
||||
PasswordEncoder passwordEncoder,
|
||||
PasswordPolicyValidator passwordPolicyValidator,
|
||||
LoginRepository loginRepository,
|
||||
LoginHistoryRepository loginHistoryRepository,
|
||||
HistoryLoginService historyLoginService,
|
||||
UserInfoService userInfoService,
|
||||
IpLocationParser ipLocationParser,
|
||||
JdbcTemplate jdbcTemplate,
|
||||
@@ -86,7 +86,7 @@ public class JdbcAuthenticationRealm extends AbstractAuthenticationRealm {
|
||||
this.passwordEncoder = passwordEncoder;
|
||||
this.passwordPolicyValidator = passwordPolicyValidator;
|
||||
this.loginRepository = loginRepository;
|
||||
this.loginHistoryRepository = loginHistoryRepository;
|
||||
this.historyLoginService = historyLoginService;
|
||||
this.userInfoService = userInfoService;
|
||||
this.ipLocationParser = ipLocationParser;
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.dromara.maxkey.authn.realm.AbstractAuthenticationRealm;
|
||||
import org.dromara.maxkey.authn.session.SessionManager;
|
||||
import org.dromara.maxkey.configuration.ApplicationConfig;
|
||||
import org.dromara.maxkey.password.sms.SmsOtpAuthnService;
|
||||
import org.dromara.maxkey.persistence.repository.LoginHistoryRepository;
|
||||
import org.dromara.maxkey.persistence.repository.LoginRepository;
|
||||
import org.dromara.maxkey.persistence.repository.PasswordPolicyValidator;
|
||||
import org.slf4j.Logger;
|
||||
@@ -109,9 +108,4 @@ public class AuthnProviderAutoConfiguration {
|
||||
return new LoginRepository(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Bean
|
||||
LoginHistoryRepository loginHistoryRepository(JdbcTemplate jdbcTemplate) {
|
||||
return new LoginHistoryRepository(jdbcTemplate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user