@Bean public to default
This commit is contained in:
@@ -76,10 +76,10 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
})
|
||||
public class MaxKeyConfig {
|
||||
private static final Logger logger = LoggerFactory.getLogger(MaxKeyConfig.class);
|
||||
|
||||
|
||||
|
||||
@Bean
|
||||
public OtpKeyUriFormat otpKeyUriFormat(
|
||||
OtpKeyUriFormat otpKeyUriFormat(
|
||||
@Value("${maxkey.otp.policy.type:totp}")
|
||||
String type,
|
||||
@Value("${maxkey.otp.policy.domain:MaxKey.top}")
|
||||
@@ -95,16 +95,16 @@ public class MaxKeyConfig {
|
||||
logger.debug("OTP KeyUri Format {}" , otpKeyUriFormat);
|
||||
return otpKeyUriFormat;
|
||||
}
|
||||
|
||||
|
||||
//可以在此实现其他的登陆认证方式,请实现AbstractAuthenticationRealm
|
||||
@Bean
|
||||
public JdbcAuthenticationRealm authenticationRealm(
|
||||
@Qualifier("passwordEncoder") PasswordEncoder passwordEncoder,
|
||||
PasswordPolicyValidator passwordPolicyValidator,
|
||||
LoginRepository loginService,
|
||||
LoginHistoryRepository loginHistoryService,
|
||||
UserInfoService userInfoService,
|
||||
IpLocationParser ipLocationParser,
|
||||
JdbcAuthenticationRealm authenticationRealm(
|
||||
@Qualifier("passwordEncoder") PasswordEncoder passwordEncoder,
|
||||
PasswordPolicyValidator passwordPolicyValidator,
|
||||
LoginRepository loginService,
|
||||
LoginHistoryRepository loginHistoryService,
|
||||
UserInfoService userInfoService,
|
||||
IpLocationParser ipLocationParser,
|
||||
JdbcTemplate jdbcTemplate,
|
||||
MailOtpAuthnService otpAuthnService,
|
||||
CnfLdapContextService ldapContextService) {
|
||||
@@ -120,9 +120,9 @@ public class MaxKeyConfig {
|
||||
ldapRealmService
|
||||
);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TimeBasedOtpAuthn timeBasedOtpAuthn(
|
||||
|
||||
@Bean
|
||||
TimeBasedOtpAuthn timeBasedOtpAuthn(
|
||||
@Value("${maxkey.otp.policy.digits:6}")
|
||||
int digits,
|
||||
@Value("${maxkey.otp.policy.period:30}")
|
||||
@@ -131,10 +131,10 @@ public class MaxKeyConfig {
|
||||
logger.debug("TimeBasedOtpAuthn inited.");
|
||||
return tfaOtpAuthn;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public AbstractOtpAuthn tfaOtpAuthn(
|
||||
@Value("${maxkey.login.mfa.type}")String mfaType,
|
||||
AbstractOtpAuthn tfaOtpAuthn(
|
||||
@Value("${maxkey.login.mfa.type}") String mfaType,
|
||||
@Value("${maxkey.otp.policy.digits:6}")
|
||||
int digits,
|
||||
@Value("${maxkey.otp.policy.period:30}")
|
||||
@@ -152,9 +152,9 @@ public class MaxKeyConfig {
|
||||
tfaOtpAuthn.initPropertys();
|
||||
return tfaOtpAuthn;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public MailOtpAuthn mailOtpAuthn(
|
||||
MailOtpAuthn mailOtpAuthn(
|
||||
EmailConfig emailConfig,
|
||||
@Value("${spring.mail.properties.mailotp.message.subject}")
|
||||
String messageSubject,
|
||||
@@ -164,7 +164,7 @@ public class MaxKeyConfig {
|
||||
int messageValidity,
|
||||
@Value("${spring.mail.properties.mailotp.message.type}")
|
||||
String messageType
|
||||
) {
|
||||
) {
|
||||
if(messageType!= null && messageType.equalsIgnoreCase("html")) {
|
||||
Resource resource = new ClassPathResource("messages/email/forgotpassword.html");
|
||||
try {
|
||||
@@ -184,10 +184,10 @@ public class MaxKeyConfig {
|
||||
logger.debug("MailOtpAuthn inited.");
|
||||
return mailOtpAuthn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Bean
|
||||
public RemoteKerberosService kerberosService(
|
||||
RemoteKerberosService kerberosService(
|
||||
@Value("${maxkey.login.kerberos.default.userdomain}")
|
||||
String userDomain,
|
||||
@Value("${maxkey.login.kerberos.default.fulluserdomain}")
|
||||
@@ -196,7 +196,7 @@ public class MaxKeyConfig {
|
||||
String crypto,
|
||||
@Value("${maxkey.login.kerberos.default.redirecturi}")
|
||||
String redirectUri
|
||||
) {
|
||||
) {
|
||||
RemoteKerberosService kerberosService = new RemoteKerberosService();
|
||||
KerberosProxy kerberosProxy = new KerberosProxy();
|
||||
|
||||
|
||||
@@ -36,18 +36,18 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
@AutoConfiguration
|
||||
public class MaxKeyMgtConfig {
|
||||
private static final Logger logger = LoggerFactory.getLogger(MaxKeyMgtConfig.class);
|
||||
|
||||
//authenticationRealm for MaxKeyMgtApplication
|
||||
@Bean
|
||||
public JdbcAuthenticationRealm authenticationRealm(
|
||||
@Qualifier("passwordEncoder")
|
||||
PasswordEncoder passwordEncoder,
|
||||
PasswordPolicyValidator passwordPolicyValidator,
|
||||
LoginRepository loginRepository,
|
||||
LoginHistoryRepository loginHistoryRepository,
|
||||
UserInfoService userInfoService,
|
||||
IpLocationParser ipLocationParser,
|
||||
JdbcTemplate jdbcTemplate) {
|
||||
|
||||
//authenticationRealm for MaxKeyMgtApplication
|
||||
@Bean
|
||||
JdbcAuthenticationRealm authenticationRealm(
|
||||
@Qualifier("passwordEncoder")
|
||||
PasswordEncoder passwordEncoder,
|
||||
PasswordPolicyValidator passwordPolicyValidator,
|
||||
LoginRepository loginRepository,
|
||||
LoginHistoryRepository loginHistoryRepository,
|
||||
UserInfoService userInfoService,
|
||||
IpLocationParser ipLocationParser,
|
||||
JdbcTemplate jdbcTemplate) {
|
||||
|
||||
JdbcAuthenticationRealm authenticationRealm = new JdbcAuthenticationRealm(
|
||||
passwordEncoder,
|
||||
@@ -62,8 +62,8 @@ public class MaxKeyMgtConfig {
|
||||
return authenticationRealm;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AbstractOtpAuthn timeBasedOtpAuthn() {
|
||||
@Bean
|
||||
AbstractOtpAuthn timeBasedOtpAuthn() {
|
||||
AbstractOtpAuthn tfaOtpAuthn = new TimeBasedOtpAuthn();
|
||||
logger.debug("TimeBasedOtpAuthn inited.");
|
||||
return tfaOtpAuthn;
|
||||
|
||||
@@ -40,11 +40,11 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@AutoConfiguration
|
||||
public class MaxKeyMgtListenerConfig {
|
||||
private static final Logger logger = LoggerFactory.getLogger(MaxKeyMgtListenerConfig.class);
|
||||
|
||||
|
||||
@Bean
|
||||
public String sessionListenerAdapter(
|
||||
Scheduler scheduler,
|
||||
SessionManager sessionManager) throws SchedulerException {
|
||||
String sessionListenerAdapter(
|
||||
Scheduler scheduler,
|
||||
SessionManager sessionManager) throws SchedulerException {
|
||||
new ScheduleAdapterBuilder()
|
||||
.setScheduler(scheduler)
|
||||
.setCron("0 0/10 * * * ?")
|
||||
@@ -54,11 +54,11 @@ public class MaxKeyMgtListenerConfig {
|
||||
logger.debug("Session ListenerAdapter inited .");
|
||||
return "sessionListenerAdapter";
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public String reorgDeptListenerAdapter(
|
||||
Scheduler scheduler,
|
||||
OrganizationsService organizationsService) throws SchedulerException {
|
||||
String reorgDeptListenerAdapter(
|
||||
Scheduler scheduler,
|
||||
OrganizationsService organizationsService) throws SchedulerException {
|
||||
new ScheduleAdapterBuilder()
|
||||
.setScheduler(scheduler)
|
||||
.setCron("0 0/30 * * * ?")
|
||||
@@ -68,13 +68,13 @@ public class MaxKeyMgtListenerConfig {
|
||||
logger.debug("ReorgDept ListenerAdapter inited .");
|
||||
return "reorgDeptListenerAdapter";
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public String dynamicGroupsListenerAdapter(
|
||||
Scheduler scheduler,
|
||||
String dynamicGroupsListenerAdapter(
|
||||
Scheduler scheduler,
|
||||
GroupsService groupsService,
|
||||
@Value("${maxkey.job.cron.schedule}") String cronSchedule
|
||||
) throws SchedulerException {
|
||||
) throws SchedulerException {
|
||||
new ScheduleAdapterBuilder()
|
||||
.setScheduler(scheduler)
|
||||
.setCron(cronSchedule)
|
||||
@@ -85,13 +85,13 @@ public class MaxKeyMgtListenerConfig {
|
||||
logger.debug("DynamicGroups ListenerAdapter inited .");
|
||||
return "dynamicGroupsListenerAdapter";
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public String provisioningRunnerThread(
|
||||
ConnectorsService connectorsService,
|
||||
JdbcTemplate jdbcTemplate,
|
||||
ApplicationConfig applicationConfig
|
||||
) {
|
||||
String provisioningRunnerThread(
|
||||
ConnectorsService connectorsService,
|
||||
JdbcTemplate jdbcTemplate,
|
||||
ApplicationConfig applicationConfig
|
||||
) {
|
||||
if(applicationConfig.isProvisionSupport()) {
|
||||
ProvisioningRunner runner = new ProvisioningRunner(connectorsService,jdbcTemplate);
|
||||
ProvisioningRunnerThread runnerThread = new ProvisioningRunnerThread(runner);
|
||||
|
||||
@@ -45,23 +45,23 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
@AutoConfiguration
|
||||
public class Oauth20ClientAutoConfiguration {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Oauth20ClientAutoConfiguration.class);
|
||||
|
||||
|
||||
@Bean
|
||||
public JdbcClientDetailsService oauth20JdbcClientDetailsService(
|
||||
DataSource dataSource , @Qualifier("passwordReciprocal") PasswordEncoder passwordReciprocal) {
|
||||
JdbcClientDetailsService oauth20JdbcClientDetailsService(
|
||||
DataSource dataSource, @Qualifier("passwordReciprocal") PasswordEncoder passwordReciprocal) {
|
||||
JdbcClientDetailsService clientDetailsService = new JdbcClientDetailsService(dataSource);
|
||||
//clientDetailsService.setPasswordEncoder(passwordReciprocal);
|
||||
logger.debug("JdbcClientDetailsService inited.");
|
||||
return clientDetailsService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TokenStore.
|
||||
* @param persistence int
|
||||
* @return oauth20TokenStore
|
||||
*/
|
||||
@Bean
|
||||
public TokenStore oauth20TokenStore(
|
||||
TokenStore oauth20TokenStore(
|
||||
@Value("${maxkey.server.persistence}") int persistence,
|
||||
JdbcTemplate jdbcTemplate,
|
||||
RedisConnectionFactory jedisConnectionFactory) {
|
||||
@@ -76,13 +76,13 @@ public class Oauth20ClientAutoConfiguration {
|
||||
|
||||
return tokenStore;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clientDetailsUserDetailsService.
|
||||
* @return oauth20TokenServices
|
||||
*/
|
||||
@Bean
|
||||
public DefaultTokenServices oauth20TokenServices(
|
||||
DefaultTokenServices oauth20TokenServices(
|
||||
JdbcClientDetailsService oauth20JdbcClientDetailsService,
|
||||
TokenStore oauth20TokenStore) {
|
||||
DefaultTokenServices tokenServices = new DefaultTokenServices();
|
||||
@@ -91,17 +91,17 @@ public class Oauth20ClientAutoConfiguration {
|
||||
tokenServices.setSupportRefreshToken(true);
|
||||
return tokenServices;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ProviderManager.
|
||||
* @return oauth20ClientAuthenticationManager
|
||||
*/
|
||||
@Bean
|
||||
public ProviderManager oauth20ClientAuthenticationManager(
|
||||
ProviderManager oauth20ClientAuthenticationManager(
|
||||
JdbcClientDetailsService oauth20JdbcClientDetailsService,
|
||||
@Qualifier("passwordReciprocal")
|
||||
PasswordEncoder passwordReciprocal
|
||||
) {
|
||||
) {
|
||||
|
||||
ClientDetailsUserDetailsService cientDetailsUserDetailsService =
|
||||
new ClientDetailsUserDetailsService(oauth20JdbcClientDetailsService);
|
||||
|
||||
@@ -36,18 +36,18 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
@AutoConfiguration
|
||||
public class MaxKeyOpenApiConfig{
|
||||
private static final Logger logger = LoggerFactory.getLogger(MaxKeyOpenApiConfig.class);
|
||||
|
||||
//authenticationRealm for MaxKeyMgtApplication
|
||||
@Bean
|
||||
public JdbcAuthenticationRealm authenticationRealm(
|
||||
@Qualifier("passwordEncoder")
|
||||
PasswordEncoder passwordEncoder,
|
||||
PasswordPolicyValidator passwordPolicyValidator,
|
||||
LoginRepository loginRepository,
|
||||
LoginHistoryRepository loginHistoryRepository,
|
||||
UserInfoService userInfoService,
|
||||
IpLocationParser ipLocationParser,
|
||||
JdbcTemplate jdbcTemplate) {
|
||||
|
||||
//authenticationRealm for MaxKeyMgtApplication
|
||||
@Bean
|
||||
JdbcAuthenticationRealm authenticationRealm(
|
||||
@Qualifier("passwordEncoder")
|
||||
PasswordEncoder passwordEncoder,
|
||||
PasswordPolicyValidator passwordPolicyValidator,
|
||||
LoginRepository loginRepository,
|
||||
LoginHistoryRepository loginHistoryRepository,
|
||||
UserInfoService userInfoService,
|
||||
IpLocationParser ipLocationParser,
|
||||
JdbcTemplate jdbcTemplate) {
|
||||
|
||||
JdbcAuthenticationRealm authenticationRealm = new JdbcAuthenticationRealm(
|
||||
passwordEncoder,
|
||||
@@ -62,8 +62,8 @@ public class MaxKeyOpenApiConfig{
|
||||
return authenticationRealm;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AbstractOtpAuthn timeBasedOtpAuthn() {
|
||||
@Bean
|
||||
AbstractOtpAuthn timeBasedOtpAuthn() {
|
||||
AbstractOtpAuthn tfaOtpAuthn = new TimeBasedOtpAuthn();
|
||||
logger.debug("TimeBasedOtpAuthn inited.");
|
||||
return tfaOtpAuthn;
|
||||
|
||||
@@ -45,23 +45,23 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
@AutoConfiguration
|
||||
public class Oauth20ClientAutoConfiguration {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Oauth20ClientAutoConfiguration.class);
|
||||
|
||||
|
||||
@Bean
|
||||
public JdbcClientDetailsService oauth20JdbcClientDetailsService(
|
||||
JdbcClientDetailsService oauth20JdbcClientDetailsService(
|
||||
DataSource dataSource, @Qualifier("passwordReciprocal") PasswordEncoder passwordReciprocal) {
|
||||
JdbcClientDetailsService clientDetailsService = new JdbcClientDetailsService(dataSource);
|
||||
//clientDetailsService.setPasswordEncoder(passwordReciprocal);
|
||||
logger.debug("JdbcClientDetailsService inited.");
|
||||
return clientDetailsService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TokenStore.
|
||||
* @param persistence int
|
||||
* @return oauth20TokenStore
|
||||
*/
|
||||
@Bean
|
||||
public TokenStore oauth20TokenStore(
|
||||
TokenStore oauth20TokenStore(
|
||||
@Value("${maxkey.server.persistence}") int persistence,
|
||||
JdbcTemplate jdbcTemplate,
|
||||
RedisConnectionFactory jedisConnectionFactory) {
|
||||
@@ -76,13 +76,13 @@ public class Oauth20ClientAutoConfiguration {
|
||||
|
||||
return tokenStore;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clientDetailsUserDetailsService.
|
||||
* @return oauth20TokenServices
|
||||
*/
|
||||
@Bean
|
||||
public DefaultTokenServices oauth20TokenServices(
|
||||
DefaultTokenServices oauth20TokenServices(
|
||||
JdbcClientDetailsService oauth20JdbcClientDetailsService,
|
||||
TokenStore oauth20TokenStore) {
|
||||
DefaultTokenServices tokenServices = new DefaultTokenServices();
|
||||
@@ -91,17 +91,17 @@ public class Oauth20ClientAutoConfiguration {
|
||||
tokenServices.setSupportRefreshToken(true);
|
||||
return tokenServices;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ProviderManager.
|
||||
* @return oauth20ClientAuthenticationManager
|
||||
*/
|
||||
@Bean
|
||||
public ProviderManager oauth20ClientAuthenticationManager(
|
||||
ProviderManager oauth20ClientAuthenticationManager(
|
||||
JdbcClientDetailsService oauth20JdbcClientDetailsService,
|
||||
@Qualifier("passwordReciprocal")
|
||||
PasswordEncoder passwordReciprocal
|
||||
) {
|
||||
) {
|
||||
|
||||
ClientDetailsUserDetailsService cientDetailsUserDetailsService =
|
||||
new ClientDetailsUserDetailsService(oauth20JdbcClientDetailsService);
|
||||
|
||||
Reference in New Issue
Block a user