@Bean public to default

This commit is contained in:
shimingxy 2024-08-19 16:24:47 +08:00
parent b7b0cd21c6
commit b6f9828ff7
24 changed files with 291 additions and 291 deletions

View File

@ -40,7 +40,7 @@ public class MvcCurrentUserAutoConfiguration implements WebMvcConfigurer {
}
@Bean
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
return new CurrentUserMethodArgumentResolver();
}

View File

@ -37,13 +37,13 @@ public class SessionAutoConfiguration {
@Bean(name = "savedRequestSuccessHandler")
public SavedRequestAwareAuthenticationSuccessHandler
SavedRequestAwareAuthenticationSuccessHandler
savedRequestAwareAuthenticationSuccessHandler() {
return new SavedRequestAwareAuthenticationSuccessHandler();
}
@Bean
public SessionManager sessionManager(
SessionManager sessionManager(
@Value("${maxkey.server.persistence}") int persistence,
JdbcTemplate jdbcTemplate,
RedisConnectionFactory redisConnFactory,
@ -55,7 +55,7 @@ public class SessionAutoConfiguration {
}
@Bean
public HttpSessionListenerAdapter httpSessionListenerAdapter() {
HttpSessionListenerAdapter httpSessionListenerAdapter() {
return new HttpSessionListenerAdapter();
}

View File

@ -40,7 +40,7 @@ public class TokenAutoConfiguration{
LoggerFactory.getLogger(TokenAutoConfiguration.class);
@Bean
public AuthTokenService authTokenService(
AuthTokenService authTokenService(
AuthJwkConfig authJwkConfig,
RedisConnectionFactory redisConnFactory,
MomentaryService momentaryService,
@ -63,7 +63,7 @@ public class TokenAutoConfiguration{
}
@Bean
public AuthRefreshTokenService refreshTokenService(AuthJwkConfig authJwkConfig) throws JOSEException {
AuthRefreshTokenService refreshTokenService(AuthJwkConfig authJwkConfig) throws JOSEException {
return new AuthRefreshTokenService(authJwkConfig);
}

View File

@ -12,7 +12,6 @@ import org.dromara.maxkey.authn.session.SessionManager;
import org.dromara.maxkey.constants.ConstsLoginType;
import org.dromara.maxkey.crypto.password.PasswordReciprocal;
import org.dromara.maxkey.entity.idm.UserInfo;
;
import org.dromara.maxkey.web.WebConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -47,7 +47,7 @@ public class AuthnProviderAutoConfiguration {
static final Logger _logger = LoggerFactory.getLogger(AuthnProviderAutoConfiguration.class);
@Bean
public AbstractAuthenticationProvider authenticationProvider(
AbstractAuthenticationProvider authenticationProvider(
NormalAuthenticationProvider normalAuthenticationProvider,
MobileAuthenticationProvider mobileAuthenticationProvider,
TrustedAuthenticationProvider trustedAuthenticationProvider,
@ -63,7 +63,7 @@ public class AuthnProviderAutoConfiguration {
}
@Bean
public NormalAuthenticationProvider normalAuthenticationProvider(
NormalAuthenticationProvider normalAuthenticationProvider(
AbstractAuthenticationRealm authenticationRealm,
ApplicationConfig applicationConfig,
SessionManager sessionManager,

View File

@ -42,14 +42,14 @@ public class JwtAuthnAutoConfiguration {
* @return
*/
@Bean
public JWKSetKeyStore jwtLoginJwkSetKeyStore() {
JWKSetKeyStore jwtLoginJwkSetKeyStore() {
JWKSetKeyStore jwkSetKeyStore = new JWKSetKeyStore();
ClassPathResource classPathResource = new ClassPathResource("/config/loginjwkkeystore.jwks");
jwkSetKeyStore.setLocation(classPathResource);
_logger.debug("JWT Login JwkSet KeyStore init.");
return jwkSetKeyStore;
}
/**
* jwt Login ValidationService.
* @return
@ -58,9 +58,9 @@ public class JwtAuthnAutoConfiguration {
* @throws NoSuchAlgorithmException
*/
@Bean
public DefaultJwtSigningAndValidationService jwtLoginValidationService(
@Qualifier("jwtLoginJwkSetKeyStore") JWKSetKeyStore jwtLoginJwkSetKeyStore)
throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException {
DefaultJwtSigningAndValidationService jwtLoginValidationService(
@Qualifier("jwtLoginJwkSetKeyStore") JWKSetKeyStore jwtLoginJwkSetKeyStore)
throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException {
DefaultJwtSigningAndValidationService jwtSignerValidationService =
new DefaultJwtSigningAndValidationService(jwtLoginJwkSetKeyStore);
jwtSignerValidationService.setDefaultSignerKeyId("maxkey_rsa");
@ -74,7 +74,7 @@ public class JwtAuthnAutoConfiguration {
* @return
*/
@Bean
public JwtLoginService jwtLoginService(
JwtLoginService jwtLoginService(
@Value("${maxkey.login.jwt.issuer}")
String issuer,
@Qualifier("jwtLoginValidationService")

View File

@ -37,7 +37,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
})
public class CasAutoConfiguration implements InitializingBean {
private static final Logger _logger = LoggerFactory.getLogger(CasAutoConfiguration.class);
/**
* TicketServices.
* @param persistence int
@ -45,7 +45,7 @@ public class CasAutoConfiguration implements InitializingBean {
* @return casTicketServices
*/
@Bean(name = "casTicketServices")
public TicketServices casTicketServices(
TicketServices casTicketServices(
@Value("${maxkey.server.persistence}") int persistence,
@Value("${maxkey.login.remeberme.validity}") int validity,
JdbcTemplate jdbcTemplate,
@ -53,7 +53,7 @@ public class CasAutoConfiguration implements InitializingBean {
_logger.debug("init casTicketServices.");
return new TicketServicesFactory().getService(persistence, jdbcTemplate, redisConnFactory);
}
/**
* TicketServices.
* @param persistence int
@ -61,7 +61,7 @@ public class CasAutoConfiguration implements InitializingBean {
* @return casTicketServices
*/
@Bean(name = "casTicketGrantingTicketServices")
public TicketServices casTicketGrantingTicketServices(
TicketServices casTicketGrantingTicketServices(
@Value("${maxkey.server.persistence}") int persistence,
@Value("${maxkey.login.remeberme.validity}") int validity,
JdbcTemplate jdbcTemplate,
@ -69,9 +69,9 @@ public class CasAutoConfiguration implements InitializingBean {
_logger.debug("init casTicketGrantingTicketServices.");
return new TicketGrantingTicketServicesFactory().getService(persistence, jdbcTemplate, redisConnFactory);
}
@Bean(name = "casProxyGrantingTicketServices")
public TicketServices casProxyGrantingTicketServices(
TicketServices casProxyGrantingTicketServices(
@Value("${maxkey.server.persistence}") int persistence,
@Value("${maxkey.login.remeberme.validity}") int validity,
JdbcTemplate jdbcTemplate,

View File

@ -74,9 +74,9 @@ import jakarta.servlet.Filter;
})
public class Oauth20AutoConfiguration implements InitializingBean {
private static final Logger _logger = LoggerFactory.getLogger(Oauth20AutoConfiguration.class);
@Bean
public FilterRegistrationBean<Filter> tokenEndpointAuthenticationFilter() {
FilterRegistrationBean<Filter> tokenEndpointAuthenticationFilter() {
_logger.debug("TokenEndpointAuthenticationFilter init ");
FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<>();
registration.setFilter(new TokenEndpointAuthenticationFilter());
@ -87,14 +87,14 @@ public class Oauth20AutoConfiguration implements InitializingBean {
registration.setOrder(1);
return registration;
}
/**
* OIDCProviderMetadataDetails.
* Self-issued Provider Metadata
* http://openid.net/specs/openid-connect-core-1_0.html#SelfIssued
*/
@Bean(name = "oidcProviderMetadata")
public OIDCProviderMetadataDetails oidcProviderMetadata(
OIDCProviderMetadataDetails oidcProviderMetadata(
@Value("${maxkey.oidc.metadata.issuer}")
String issuer,
@Value("${maxkey.oidc.metadata.authorizationEndpoint}")
@ -117,14 +117,14 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return
*/
@Bean(name = "jwkSetKeyStore")
public JWKSetKeyStore jwkSetKeyStore() {
JWKSetKeyStore jwkSetKeyStore() {
JWKSetKeyStore jwkSetKeyStore = new JWKSetKeyStore();
ClassPathResource classPathResource = new ClassPathResource("/config/keystore.jwks");
jwkSetKeyStore.setLocation(classPathResource);
_logger.debug("JWKSet KeyStore init.");
return jwkSetKeyStore;
}
/**
* jwtSetKeyStore.
* @return
@ -133,10 +133,10 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @throws NoSuchAlgorithmException
*/
@Bean(name = "jwtSignerValidationService")
public DefaultJwtSigningAndValidationService jwtSignerValidationService(
@Qualifier("jwkSetKeyStore")
JWKSetKeyStore jwkSetKeyStore)
throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException {
DefaultJwtSigningAndValidationService jwtSignerValidationService(
@Qualifier("jwkSetKeyStore")
JWKSetKeyStore jwkSetKeyStore)
throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException {
DefaultJwtSigningAndValidationService jwtSignerValidationService =
new DefaultJwtSigningAndValidationService(jwkSetKeyStore);
jwtSignerValidationService.setDefaultSignerKeyId("maxkey_rsa");
@ -144,7 +144,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
_logger.debug("JWT Signer and Validation Service init.");
return jwtSignerValidationService;
}
/**
* jwtSetKeyStore.
* @return
@ -153,10 +153,10 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @throws NoSuchAlgorithmException
*/
@Bean(name = "jwtEncryptionService")
public DefaultJwtEncryptionAndDecryptionService jwtEncryptionService(
@Qualifier("jwkSetKeyStore")
JWKSetKeyStore jwkSetKeyStore)
throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException {
DefaultJwtEncryptionAndDecryptionService jwtEncryptionService(
@Qualifier("jwkSetKeyStore")
JWKSetKeyStore jwkSetKeyStore)
throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException {
DefaultJwtEncryptionAndDecryptionService jwtEncryptionService =
new DefaultJwtEncryptionAndDecryptionService(jwkSetKeyStore);
jwtEncryptionService.setDefaultAlgorithm(JWEAlgorithm.RSA_OAEP_256);//RSA1_5
@ -165,13 +165,13 @@ public class Oauth20AutoConfiguration implements InitializingBean {
_logger.debug("JWT Encryption and Decryption Service init.");
return jwtEncryptionService;
}
/**
* tokenEnhancer.
* @return
*/
@Bean(name = "tokenEnhancer")
public OIDCIdTokenEnhancer tokenEnhancer(
OIDCIdTokenEnhancer tokenEnhancer(
OIDCProviderMetadataDetails oidcProviderMetadata,
ClientDetailsService oauth20JdbcClientDetailsService) {
OIDCIdTokenEnhancer tokenEnhancer = new OIDCIdTokenEnhancer();
@ -180,6 +180,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
_logger.debug("OIDC IdToken Enhancer init.");
return tokenEnhancer;
}
//以上部分为了支持OpenID Connect 1.0
@ -189,57 +190,57 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return oauth20AuthorizationCodeServices
*/
@Bean(name = "oauth20AuthorizationCodeServices")
public AuthorizationCodeServices oauth20AuthorizationCodeServices(
AuthorizationCodeServices oauth20AuthorizationCodeServices(
@Value("${maxkey.server.persistence}") int persistence,
JdbcTemplate jdbcTemplate,
RedisConnectionFactory redisConnFactory) {
_logger.debug("OAuth 2 Authorization Code Services init.");
return new AuthorizationCodeServicesFactory().getService(persistence, jdbcTemplate, redisConnFactory);
}
/**
* TokenStore.
* @param persistence int
* @return oauth20TokenStore
*/
@Bean(name = "oauth20TokenStore")
public TokenStore oauth20TokenStore(
TokenStore oauth20TokenStore(
@Value("${maxkey.server.persistence}") int persistence,
JdbcTemplate jdbcTemplate,
RedisConnectionFactory redisConnFactory) {
_logger.debug("OAuth 2 TokenStore init.");
return new TokenStoreFactory().getTokenStore(persistence, jdbcTemplate, redisConnFactory);
}
/**
* jwtAccessTokenConverter.
* @return converter
*/
@Bean(name = "converter")
public JwtAccessTokenConverter jwtAccessTokenConverter() {
JwtAccessTokenConverter jwtAccessTokenConverter() {
JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
_logger.debug("OAuth 2 Jwt AccessToken Converter init.");
return jwtAccessTokenConverter;
}
/**
* clientDetailsService.
* @return oauth20JdbcClientDetailsService
*/
@Bean(name = "oauth20JdbcClientDetailsService")
public JdbcClientDetailsService jdbcClientDetailsService(DataSource dataSource,@Qualifier("passwordReciprocal") PasswordEncoder passwordReciprocal) {
JdbcClientDetailsService jdbcClientDetailsService(DataSource dataSource, @Qualifier("passwordReciprocal") PasswordEncoder passwordReciprocal) {
JdbcClientDetailsService clientDetailsService = new JdbcClientDetailsService(dataSource);
//clientDetailsService.setPasswordEncoder(passwordReciprocal);
_logger.debug("OAuth 2 Jdbc ClientDetails Service init.");
return clientDetailsService;
}
}
/**
* clientDetailsUserDetailsService.
* @return oauth20TokenServices
*/
@Bean(name = "oauth20TokenServices")
public DefaultTokenServices defaultTokenServices(
DefaultTokenServices defaultTokenServices(
JdbcClientDetailsService oauth20JdbcClientDetailsService,
TokenStore oauth20TokenStore,
OIDCIdTokenEnhancer tokenEnhancer) {
@ -251,45 +252,45 @@ public class Oauth20AutoConfiguration implements InitializingBean {
_logger.debug("OAuth 2 Token Services init.");
return tokenServices;
}
/**
* TokenApprovalStore.
* @return oauth20ApprovalStore
*/
@Bean(name = "oauth20ApprovalStore")
public TokenApprovalStore tokenApprovalStore(
TokenApprovalStore tokenApprovalStore(
TokenStore oauth20TokenStore) {
TokenApprovalStore tokenApprovalStore = new TokenApprovalStore();
tokenApprovalStore.setTokenStore(oauth20TokenStore);
_logger.debug("OAuth 2 Approval Store init.");
return tokenApprovalStore;
}
/**
* OAuth2RequestFactory.
* @return oAuth2RequestFactory
*/
@Bean(name = "oAuth2RequestFactory")
public DefaultOAuth2RequestFactory oauth2RequestFactory(
DefaultOAuth2RequestFactory oauth2RequestFactory(
JdbcClientDetailsService oauth20JdbcClientDetailsService) {
DefaultOAuth2RequestFactory oauth2RequestFactory =
new DefaultOAuth2RequestFactory(oauth20JdbcClientDetailsService);
_logger.debug("OAuth 2 Request Factory init.");
return oauth2RequestFactory;
}
/**
* OAuth20UserApprovalHandler.
* @return oauth20UserApprovalHandler
*/
@Bean(name = "oauth20UserApprovalHandler")
public OAuth20UserApprovalHandler oauth20UserApprovalHandler(
OAuth20UserApprovalHandler oauth20UserApprovalHandler(
JdbcClientDetailsService oauth20JdbcClientDetailsService,
DefaultOAuth2RequestFactory oAuth2RequestFactory,
TokenApprovalStore oauth20ApprovalStore
) {
) {
OAuth20UserApprovalHandler userApprovalHandler = new OAuth20UserApprovalHandler();
userApprovalHandler.setApprovalStore(oauth20ApprovalStore);
userApprovalHandler.setRequestFactory(oAuth2RequestFactory);
@ -297,17 +298,17 @@ public class Oauth20AutoConfiguration implements InitializingBean {
_logger.debug("OAuth 2 User Approval Handler init.");
return userApprovalHandler;
}
/**
* ProviderManager.
* @return oauth20UserAuthenticationManager
*/
@Bean(name = "oauth20UserAuthenticationManager")
public ProviderManager oauth20UserAuthenticationManager(
@Qualifier("passwordEncoder")
ProviderManager oauth20UserAuthenticationManager(
@Qualifier("passwordEncoder")
PasswordEncoder passwordEncoder,
LoginRepository loginRepository
) {
) {
OAuth2UserDetailsService userDetailsService =new OAuth2UserDetailsService();
userDetailsService.setLoginRepository(loginRepository);
@ -319,17 +320,17 @@ public class Oauth20AutoConfiguration implements InitializingBean {
_logger.debug("OAuth 2 User Authentication Manager init.");
return authenticationManager;
}
/**
* ProviderManager.
* @return oauth20ClientAuthenticationManager
*/
@Bean(name = "oauth20ClientAuthenticationManager")
public ProviderManager oauth20ClientAuthenticationManager(
ProviderManager oauth20ClientAuthenticationManager(
JdbcClientDetailsService oauth20JdbcClientDetailsService,
@Qualifier("passwordReciprocal")
@Qualifier("passwordReciprocal")
PasswordEncoder passwordReciprocal
) {
) {
ClientDetailsUserDetailsService cientDetailsUserDetailsService =
new ClientDetailsUserDetailsService(oauth20JdbcClientDetailsService);

View File

@ -60,76 +60,76 @@ import org.springframework.ui.velocity.VelocityEngineFactoryBean;
})
public class Saml20AutoConfiguration implements InitializingBean {
private static final Logger _logger = LoggerFactory.getLogger(Saml20AutoConfiguration.class);
/**
* samlBootstrapInitializer.
* @return samlBootstrapInitializer
* @throws ConfigurationException
*/
@Bean(name = "samlBootstrapInitializer")
public String samlBootstrapInitializer() throws ConfigurationException {
String samlBootstrapInitializer() throws ConfigurationException {
org.opensaml.DefaultBootstrap.bootstrap();
return "";
}
/**
* TimeService.
* @return timeService
*/
@Bean(name = "timeService")
public TimeService TimeService() {
TimeService TimeService() {
TimeService timeService = new TimeService();
return timeService;
}
/**
* IDService.
* @return idService
*/
@Bean(name = "idService")
public IDService idService() {
IDService idService() {
IDService idService = new IDService();
return idService;
}
/**
* EndpointGenerator.
* @return endpointGenerator
*/
@Bean(name = "endpointGenerator")
public EndpointGenerator endpointGenerator() {
EndpointGenerator endpointGenerator() {
EndpointGenerator generator = new EndpointGenerator();
return generator;
}
/**
* AuthnResponseGenerator.
* @return authnResponseGenerator
*/
@Bean(name = "authnResponseGenerator")
public AuthnResponseGenerator authnResponseGenerator(TimeService timeService,IDService idService,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
AuthnResponseGenerator authnResponseGenerator(TimeService timeService, IDService idService,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
_logger.debug("issuerEntityName {}" , issuerEntityName);
AuthnResponseGenerator generator = new AuthnResponseGenerator(issuerEntityName,timeService,idService);
return generator;
}
/**
* IssuerEntityName.
* @return issuerEntityName
*/
@Bean(name = "issuerEntityName")
public String issuerEntityName(
String issuerEntityName(
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
return issuerEntityName;
}
/**
* Saml20Metadata.
* @return saml20Metadata
*/
@Bean(name = "saml20Metadata")
public Saml20Metadata saml20Metadata(
Saml20Metadata saml20Metadata(
@Value("${maxkey.saml.v20.metadata.orgName}") String orgName,
@Value("${maxkey.saml.v20.metadata.orgDisplayName}") String orgDisplayName,
@Value("${maxkey.saml.v20.metadata.orgURL}") String orgURL,
@ -157,31 +157,31 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return samlValidaotrSuite
*/
@Bean(name = "samlValidaotrSuite")
public SAML2ValidatorSuite validatorSuite() {
SAML2ValidatorSuite validatorSuite() {
SAML2ValidatorSuite validatorSuite = new SAML2ValidatorSuite();
return validatorSuite;
}
/**
* MapBasedStorageService.
* @return mapBasedStorageService
*/
@SuppressWarnings("rawtypes")
@Bean(name = "mapBasedStorageService")
public MapBasedStorageService mapBasedStorageService() {
MapBasedStorageService mapBasedStorageService() {
MapBasedStorageService mapBasedStorageService = new MapBasedStorageService();
return mapBasedStorageService;
}
/**
* VelocityEngineFactoryBean.
* @return velocityEngine
* @throws IOException
* @throws VelocityException
*/
@SuppressWarnings({ "deprecation"})
@SuppressWarnings({"deprecation"})
@Bean(name = "velocityEngine")
public VelocityEngine velocityEngine() throws VelocityException, IOException {
VelocityEngine velocityEngine() throws VelocityException, IOException {
VelocityEngineFactoryBean factory = new VelocityEngineFactoryBean();
factory.setPreferFileSystemAccess(false);
Properties velocityProperties = new Properties();
@ -191,138 +191,138 @@ public class Saml20AutoConfiguration implements InitializingBean {
factory.setVelocityProperties(velocityProperties);
return factory.createVelocityEngine();
}
/**
* ReplayCache.
* @return replayCache
*/
@Bean(name = "replayCache")
public ReplayCache replayCache(MapBasedStorageService<String, ReplayCacheEntry> mapBasedStorageService,
@Value("${maxkey.saml.v20.replay.cache.life.in.millis}") long duration) {
ReplayCache replayCache(MapBasedStorageService<String, ReplayCacheEntry> mapBasedStorageService,
@Value("${maxkey.saml.v20.replay.cache.life.in.millis}") long duration) {
ReplayCache replayCache = new ReplayCache(mapBasedStorageService,duration);
return replayCache;
}
/**
* MessageReplayRule.
* @return messageReplayRule
*/
@Bean(name = "messageReplayRule")
public MessageReplayRule messageReplayRule(ReplayCache replayCache) {
MessageReplayRule messageReplayRule(ReplayCache replayCache) {
MessageReplayRule messageReplayRule = new MessageReplayRule(replayCache);
return messageReplayRule;
}
/**
* BasicParserPool.
* @return samlParserPool
*/
@Bean(name = "samlParserPool")
public BasicParserPool samlParserPool(
BasicParserPool samlParserPool(
@Value("${maxkey.saml.v20.max.parser.pool.size}") int maxPoolSize) {
BasicParserPool samlParserPool = new BasicParserPool();
samlParserPool.setMaxPoolSize(maxPoolSize);
return samlParserPool;
}
/**
* IssueInstantRule.
* @return issueInstantRule
*/
@Bean(name = "issueInstantRule")
public IssueInstantRule issueInstantRule(
IssueInstantRule issueInstantRule(
@Value("${maxkey.saml.v20.issue.instant.check.clock.skew.in.seconds}") int newClockSkew,
@Value("${maxkey.saml.v20.issue.instant.check.validity.time.in.seconds}") int newExpires) {
IssueInstantRule decoder = new IssueInstantRule(newClockSkew,newExpires);
decoder.setRequiredRule(true);
return decoder;
}
/**
* OpenHTTPPostSimpleSignDecoder.
* @return openHTTPPostSimpleSignDecoder
*/
@Bean(name = "openHTTPPostSimpleSignDecoder")
public OpenHTTPPostSimpleSignDecoder openHTTPPostSimpleSignDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPPostSimpleSignDecoder openHTTPPostSimpleSignDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPPostSimpleSignDecoder decoder = new OpenHTTPPostSimpleSignDecoder(samlParserPool);
decoder.setReceiverEndpoint(receiverEndpoint);
return decoder;
}
/**
* OpenHTTPPostDecoder.
* @return openHTTPPostDecoder
*/
@Bean(name = "openHTTPPostDecoder")
public OpenHTTPPostDecoder openHTTPPostDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPPostDecoder openHTTPPostDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPPostDecoder decoder = new OpenHTTPPostDecoder(samlParserPool);
decoder.setReceiverEndpoint(receiverEndpoint);
return decoder;
}
/**
* OpenHTTPRedirectDecoder.
* @return openHTTPRedirectDecoder
*/
@Bean(name = "openHTTPRedirectDecoder")
public OpenHTTPRedirectDecoder openHTTPRedirectDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPRedirectDecoder openHTTPRedirectDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPRedirectDecoder decoder = new OpenHTTPRedirectDecoder(samlParserPool);
decoder.setReceiverEndpoint(receiverEndpoint);
return decoder;
}
/**
* ExtractPostBindingAdapter.
* @return extractPostBindingAdapter
*/
@Bean(name = "extractPostBindingAdapter")
public ExtractPostBindingAdapter extractPostBindingAdapter(OpenHTTPPostDecoder openHTTPPostDecoder,
@Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader,IssueInstantRule issueInstantRule,MessageReplayRule messageReplayRule) {
ExtractPostBindingAdapter extractPostBindingAdapter(OpenHTTPPostDecoder openHTTPPostDecoder,
@Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader, IssueInstantRule issueInstantRule, MessageReplayRule messageReplayRule) {
ExtractPostBindingAdapter adapter = new ExtractPostBindingAdapter(openHTTPPostDecoder);
adapter.setIssueInstantRule(issueInstantRule);
adapter.setKeyStoreLoader(keyStoreLoader);
adapter.setMessageReplayRule(messageReplayRule);
return adapter;
}
/**
* ExtractRedirectBindingAdapter.
* @return extractRedirectBindingAdapter
*/
@Bean(name = "extractRedirectBindingAdapter")
public ExtractRedirectBindingAdapter extractRedirectBindingAdapter(OpenHTTPRedirectDecoder openHTTPRedirectDecoder,
@Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader,IssueInstantRule issueInstantRule,MessageReplayRule messageReplayRule) {
ExtractRedirectBindingAdapter extractRedirectBindingAdapter(OpenHTTPRedirectDecoder openHTTPRedirectDecoder,
@Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader, IssueInstantRule issueInstantRule, MessageReplayRule messageReplayRule) {
ExtractRedirectBindingAdapter adapter = new ExtractRedirectBindingAdapter(openHTTPRedirectDecoder);
adapter.setIssueInstantRule(issueInstantRule);
adapter.setKeyStoreLoader(keyStoreLoader);
adapter.setMessageReplayRule(messageReplayRule);
return adapter;
}
/**
* PostSimpleSignBindingAdapter.
* @return postSimpleSignBindingAdapter
*/
@Bean(name = "postSimpleSignBindingAdapter")
public PostSimpleSignBindingAdapter postSimpleSignBindingAdapter(VelocityEngine velocityEngine,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
PostSimpleSignBindingAdapter postSimpleSignBindingAdapter(VelocityEngine velocityEngine,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
PostSimpleSignBindingAdapter adapter = new PostSimpleSignBindingAdapter();
adapter.setVelocityEngine(velocityEngine);
adapter.setIssuerEntityName(issuerEntityName);
return adapter;
}
/**
* PostBindingAdapter.
* @return postBindingAdapter
*/
@Bean(name = "postBindingAdapter")
public PostBindingAdapter postBindingAdapter(VelocityEngine velocityEngine,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
PostBindingAdapter postBindingAdapter(VelocityEngine velocityEngine,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
PostBindingAdapter adapter = new PostBindingAdapter();
adapter.setVelocityEngine(velocityEngine);
adapter.setIssuerEntityName(issuerEntityName);

View File

@ -121,7 +121,7 @@ public class IpLocationAutoConfiguration {
* @throws Exception
*/
@Bean
public IpLocationParser ipLocationParser(
IpLocationParser ipLocationParser(
@Value("${maxkey.login.iplocation:true}") boolean isIplocation,
@Value("${maxkey.login.iplocation.online.provider:none}") String onlineProvider,
@Value("${maxkey.login.iplocation.offline.provider:Ip2Region}") String offlineProvider) throws Exception {

View File

@ -33,10 +33,10 @@ import org.springframework.context.annotation.Bean;
public class OneTimePasswordAutoConfiguration {
private static final Logger _logger =
LoggerFactory.getLogger(OneTimePasswordAutoConfiguration.class);
@Bean(name = "mailOtpAuthnService")
public MailOtpAuthnService mailOtpAuthnService(
MailOtpAuthnService mailOtpAuthnService(
@Value("${maxkey.server.persistence}") int persistence,
CnfEmailSendersService emailSendersService,
RedisConnectionFactory redisConnFactory) {

View File

@ -33,10 +33,10 @@ import org.springframework.context.annotation.Bean;
@AutoConfiguration
public class SmsAutoConfiguration {
private static final Logger _logger = LoggerFactory.getLogger(SmsAutoConfiguration.class);
@Bean(name = "smsOtpAuthnService")
public SmsOtpAuthnService smsOtpAuthnService(
SmsOtpAuthnService smsOtpAuthnService(
@Value("${maxkey.server.persistence}") int persistence,
CnfSmsProviderService smsProviderService,
CnfEmailSendersService emailSendersService,

View File

@ -58,27 +58,27 @@ public class ApplicationAutoConfiguration {
static final Logger _logger = LoggerFactory.getLogger(ApplicationAutoConfiguration.class);
@Bean
public PasswordReciprocal passwordReciprocal() {
PasswordReciprocal passwordReciprocal() {
return new PasswordReciprocal();
}
@Bean
public DataSourceTransactionManager transactionManager(DataSource dataSource) {
DataSourceTransactionManager transactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean
public InstitutionsRepository institutionsRepository(JdbcTemplate jdbcTemplate) {
InstitutionsRepository institutionsRepository(JdbcTemplate jdbcTemplate) {
return new InstitutionsRepository(jdbcTemplate);
}
/**
* Authentication Password Encoder .
* @return
*/
@Bean
public PasswordEncoder passwordEncoder(
@Value("${maxkey.crypto.password.encoder:bcrypt}") String idForEncode) {
PasswordEncoder passwordEncoder(
@Value("${maxkey.crypto.password.encoder:bcrypt}") String idForEncode) {
Map<String ,PasswordEncoder > encoders = new HashMap<>();
encoders.put("bcrypt", new BCryptPasswordEncoder());
encoders.put("plain", NoOpPasswordEncoder.getInstance());
@ -111,13 +111,13 @@ public class ApplicationAutoConfiguration {
return passwordEncoder;
}
/**
* keyStoreLoader .
* @return
*/
@Bean
public KeyStoreLoader keyStoreLoader(
KeyStoreLoader keyStoreLoader(
@Value("${maxkey.saml.v20.idp.issuing.entity.id}") String entityName,
@Value("${maxkey.saml.v20.idp.keystore.password}") String keystorePassword,
@Value("${maxkey.saml.v20.idp.keystore}") Resource keystoreFile) {
@ -127,13 +127,13 @@ public class ApplicationAutoConfiguration {
keyStoreLoader.setKeystoreFile(keystoreFile);
return keyStoreLoader;
}
/**
* spKeyStoreLoader .
* @return
*/
@Bean
public KeyStoreLoader serviceProviderKeyStoreLoader(
KeyStoreLoader serviceProviderKeyStoreLoader(
@Value("${maxkey.saml.v20.sp.issuing.entity.id}") String entityName,
@Value("${maxkey.saml.v20.sp.keystore.password}") String keystorePassword,
@Value("${maxkey.saml.v20.sp.keystore}") Resource keystoreFile) {
@ -143,23 +143,23 @@ public class ApplicationAutoConfiguration {
keyStoreLoader.setKeystoreFile(keystoreFile);
return keyStoreLoader;
}
/**
* spKeyStoreLoader .
* @return
*/
@Bean
public String spIssuingEntityName(
String spIssuingEntityName(
@Value("${maxkey.saml.v20.sp.issuing.entity.id}") String spIssuingEntityName) {
return spIssuingEntityName;
}
/**
* Id Generator .
* @return
*/
@Bean
public IdGenerator idGenerator(
IdGenerator idGenerator(
@Value("${maxkey.id.strategy:SnowFlake}") String strategy,
@Value("${maxkey.id.datacenterId:0}") int datacenterId,
@Value("${maxkey.id.machineId:0}") int machineId) {
@ -170,11 +170,11 @@ public class ApplicationAutoConfiguration {
return idGenerator;
}
@Bean
public MomentaryService momentaryService(
RedisConnectionFactory redisConnFactory,
@Value("${maxkey.server.persistence}") int persistence) {
MomentaryService momentaryService(
RedisConnectionFactory redisConnFactory,
@Value("${maxkey.server.persistence}") int persistence) {
MomentaryService momentaryService;
if (persistence == ConstsPersistence.REDIS) {
momentaryService = new RedisMomentaryService(redisConnFactory);

View File

@ -73,14 +73,14 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
@Value("${spring.jackson.date-format:yyyy-MM-dd HH:mm:ss}")
private String pattern;
/**
* 消息处理可以直接使用properties的key值返回的是对应的value值
* messageSource .
* @return messageSource
*/
@Bean (name = "messageSource")
public ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource(
@Bean(name = "messageSource")
ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource(
@Value("${spring.messages.basename:classpath:messages/message}")
String messagesBasename) {
_logger.debug("Basename {}" , messagesBasename);
@ -91,48 +91,48 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
messageSource.setUseCodeAsDefaultMessage(false);
return messageSource;
}
/**
* Locale Change Interceptor and Resolver definition .
* @return localeChangeInterceptor
*/
//@Primary
@Bean (name = "localeChangeInterceptor")
public LocaleChangeInterceptor localeChangeInterceptor() {
@Bean(name = "localeChangeInterceptor")
LocaleChangeInterceptor localeChangeInterceptor() {
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("language");
return localeChangeInterceptor;
}
/**
* handlerMapping .
* @return handlerMapping
*/
@Bean (name = "handlerMapping")
public RequestMappingHandlerMapping requestMappingHandlerMapping(
@Bean(name = "handlerMapping")
RequestMappingHandlerMapping requestMappingHandlerMapping(
LocaleChangeInterceptor localeChangeInterceptor) {
RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping();
requestMappingHandlerMapping.setInterceptors(localeChangeInterceptor);
return requestMappingHandlerMapping;
}
/**
* jaxb2Marshaller .
* @return jaxb2Marshaller
*/
@Bean (name = "jaxb2Marshaller")
public Jaxb2Marshaller jaxb2Marshaller() {
@Bean(name = "jaxb2Marshaller")
Jaxb2Marshaller jaxb2Marshaller() {
Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
jaxb2Marshaller.setClassesToBeBound(org.dromara.maxkey.entity.xml.UserInfoXML.class);;
return jaxb2Marshaller;
}
/**
* marshallingHttpMessageConverter .
* @return marshallingHttpMessageConverter
*/
@Bean (name = "marshallingHttpMessageConverter")
public MarshallingHttpMessageConverter marshallingHttpMessageConverter(
@Bean(name = "marshallingHttpMessageConverter")
MarshallingHttpMessageConverter marshallingHttpMessageConverter(
Jaxb2Marshaller jaxb2Marshaller) {
MarshallingHttpMessageConverter marshallingHttpMessageConverter = new MarshallingHttpMessageConverter();
marshallingHttpMessageConverter.setMarshaller(jaxb2Marshaller);
@ -145,13 +145,13 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
marshallingHttpMessageConverter.setSupportedMediaTypes(mediaTypesList);
return marshallingHttpMessageConverter;
}
/**
* mappingJacksonHttpMessageConverter .
* @return mappingJacksonHttpMessageConverter
*/
@Bean (name = "mappingJacksonHttpMessageConverter")
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
@Bean(name = "mappingJacksonHttpMessageConverter")
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter = new MappingJackson2HttpMessageConverter();
ArrayList<MediaType> mediaTypesList = new ArrayList<>();
mediaTypesList.add(MediaType.APPLICATION_JSON);
@ -169,32 +169,32 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
mappingJacksonHttpMessageConverter.setObjectMapper(objectMapper);
return mappingJacksonHttpMessageConverter;
}
/**
* cookieLocaleResolver .
* @return cookieLocaleResolver
*/
@Bean(name = "cookieLocaleResolver")
public LocaleResolver cookieLocaleResolver(
LocaleResolver cookieLocaleResolver(
@Value("${maxkey.server.domain:maxkey.top}")
String domainName
) {
) {
_logger.debug("DomainName {}" , domainName);
CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver("mxk_locale");
cookieLocaleResolver.setCookieDomain(domainName);
cookieLocaleResolver.setCookieMaxAge(Duration.ofDays(14));
return cookieLocaleResolver;
}
/**
* AnnotationMethodHandlerAdapter
* requestMappingHandlerAdapter .
* @return requestMappingHandlerAdapter
*/
@Bean (name = "addConverterRequestMappingHandlerAdapter")
public RequestMappingHandlerAdapter requestMappingHandlerAdapter(
@Qualifier("mappingJacksonHttpMessageConverter")
@Bean(name = "addConverterRequestMappingHandlerAdapter")
RequestMappingHandlerAdapter requestMappingHandlerAdapter(
@Qualifier("mappingJacksonHttpMessageConverter")
MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter,
MarshallingHttpMessageConverter marshallingHttpMessageConverter,
StringHttpMessageConverter stringHttpMessageConverter,
@ -212,14 +212,14 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
requestMappingHandlerAdapter.setMessageConverters(httpMessageConverterList);
return requestMappingHandlerAdapter;
}
/**
* restTemplate .
* @return restTemplate
*/
@Bean (name = "restTemplate")
public RestTemplate restTemplate(
@Qualifier("mappingJacksonHttpMessageConverter")
@Bean(name = "restTemplate")
RestTemplate restTemplate(
@Qualifier("mappingJacksonHttpMessageConverter")
MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter,
MarshallingHttpMessageConverter marshallingHttpMessageConverter) {
RestTemplate restTemplate = new RestTemplate();
@ -236,7 +236,7 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
* @return webServerFactoryCustomizer
*/
@Bean
public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer() {
WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer() {
return new WebServerFactoryCustomizer<ConfigurableWebServerFactory>() {
@Override
public void customize(ConfigurableWebServerFactory factory) {
@ -251,15 +251,15 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
}
};
}
@Bean
public SecurityContextHolderAwareRequestFilter securityContextHolderAwareRequestFilter() {
SecurityContextHolderAwareRequestFilter securityContextHolderAwareRequestFilter() {
_logger.debug("securityContextHolderAwareRequestFilter init ");
return new SecurityContextHolderAwareRequestFilter();
}
@Bean
public FilterRegistrationBean<CorsFilter> corsFilter() {
FilterRegistrationBean<CorsFilter> corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.setAllowCredentials(true);
@ -273,9 +273,9 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
bean.addUrlPatterns("/*");
return bean;
}
@Bean
public FilterRegistrationBean<Filter> delegatingFilterProxy() {
FilterRegistrationBean<Filter> delegatingFilterProxy() {
_logger.debug("delegatingFilterProxy init for /* ");
FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(new DelegatingFilterProxy("securityContextHolderAwareRequestFilter"));
@ -286,9 +286,9 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
return registrationBean;
}
@Bean
public FilterRegistrationBean<Filter> webXssRequestFilter() {
FilterRegistrationBean<Filter> webXssRequestFilter() {
_logger.debug("webXssRequestFilter init for /* ");
FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean<>(new WebXssRequestFilter());
registrationBean.addUrlPatterns("/*");
@ -296,11 +296,11 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
registrationBean.setOrder(3);
return registrationBean;
}
@Bean
public FilterRegistrationBean<Filter> webInstRequestFilter(
InstitutionsRepository institutionsRepository,
ApplicationConfig applicationConfig) {
FilterRegistrationBean<Filter> webInstRequestFilter(
InstitutionsRepository institutionsRepository,
ApplicationConfig applicationConfig) {
_logger.debug("WebInstRequestFilter init for /* ");
FilterRegistrationBean<Filter> registrationBean =
new FilterRegistrationBean<>(new WebInstRequestFilter(institutionsRepository,applicationConfig));

View File

@ -28,7 +28,7 @@ import redis.clients.jedis.JedisPoolConfig;
@AutoConfiguration
public class RedisAutoConfiguration {
static final Logger _logger = LoggerFactory.getLogger(RedisAutoConfiguration.class);
/**
* RedisConnectionFactory.
* @param host String
@ -42,7 +42,7 @@ public class RedisAutoConfiguration {
* @return RedisConnectionFactory
*/
@Bean
public RedisConnectionFactory redisConnFactory(
RedisConnectionFactory redisConnFactory(
@Value("${spring.redis.host}")
String host,
@Value("${spring.redis.port:6379}")

View File

@ -33,7 +33,7 @@ public class SwaggerAutoConfiguration {
boolean enable;
@Bean
public GlobalOpenApiCustomizer orderGlobalOpenApiCustomizer() {
GlobalOpenApiCustomizer orderGlobalOpenApiCustomizer() {
return openApi -> {
if (openApi.getTags()!=null){
openApi.getTags().forEach(tag -> {
@ -49,9 +49,9 @@ public class SwaggerAutoConfiguration {
};
}
@Bean
public GroupedOpenApi userApi(){
GroupedOpenApi userApi(){
String[] paths = {
"/login",
"/logout",
@ -70,9 +70,9 @@ public class SwaggerAutoConfiguration {
.pathsToMatch(paths)
.packagesToScan(packagedToMatch).build();
}
@Bean
public OpenAPI docOpenAPI() {
@Bean
OpenAPI docOpenAPI() {
return new OpenAPI()
.info(
new Info()

View File

@ -47,13 +47,13 @@ import org.springframework.scheduling.quartz.SchedulerFactoryBean;
public class SynchronizerAutoConfiguration implements InitializingBean {
private static final Logger _logger = LoggerFactory.getLogger(SynchronizerAutoConfiguration.class);
public static final String SYNCHRONIZERS_SELECT_STATEMENT = "select * from mxk_synchronizers where status ='1'";
@Bean(name = "schedulerSynchronizerJobs")
public String schedulerSynchronizerJobs(
JdbcTemplate jdbcTemplate,
SchedulerFactoryBean schedulerFactoryBean,
@Value("${maxkey.job.cron.enable}") boolean jobCronEnable
) throws SchedulerException {
@Bean(name = "schedulerSynchronizerJobs")
String schedulerSynchronizerJobs(
JdbcTemplate jdbcTemplate,
SchedulerFactoryBean schedulerFactoryBean,
@Value("${maxkey.job.cron.enable}") boolean jobCronEnable
) throws SchedulerException {
Scheduler scheduler = schedulerFactoryBean.getScheduler();
if(jobCronEnable) {

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -1,7 +1,7 @@
echo off
echo set env
set JAVA_HOME=C:\IDE\jdk-17.0.2.8
set GRADLE_HOME=C:\IDE\gradle-8.8
set JAVA_HOME=C:\ide\jdk-17.0.9+9
set GRADLE_HOME=C:\ide\gradle-8.8
call %JAVA_HOME%/bin/java -version
call %GRADLE_HOME%/bin/gradle -version