@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 @Bean
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() { CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
return new CurrentUserMethodArgumentResolver(); return new CurrentUserMethodArgumentResolver();
} }

View File

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

View File

@ -40,7 +40,7 @@ public class TokenAutoConfiguration{
LoggerFactory.getLogger(TokenAutoConfiguration.class); LoggerFactory.getLogger(TokenAutoConfiguration.class);
@Bean @Bean
public AuthTokenService authTokenService( AuthTokenService authTokenService(
AuthJwkConfig authJwkConfig, AuthJwkConfig authJwkConfig,
RedisConnectionFactory redisConnFactory, RedisConnectionFactory redisConnFactory,
MomentaryService momentaryService, MomentaryService momentaryService,
@ -63,7 +63,7 @@ public class TokenAutoConfiguration{
} }
@Bean @Bean
public AuthRefreshTokenService refreshTokenService(AuthJwkConfig authJwkConfig) throws JOSEException { AuthRefreshTokenService refreshTokenService(AuthJwkConfig authJwkConfig) throws JOSEException {
return new AuthRefreshTokenService(authJwkConfig); 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.constants.ConstsLoginType;
import org.dromara.maxkey.crypto.password.PasswordReciprocal; import org.dromara.maxkey.crypto.password.PasswordReciprocal;
import org.dromara.maxkey.entity.idm.UserInfo; import org.dromara.maxkey.entity.idm.UserInfo;
;
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;

View File

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

View File

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

View File

@ -45,7 +45,7 @@ public class CasAutoConfiguration implements InitializingBean {
* @return casTicketServices * @return casTicketServices
*/ */
@Bean(name = "casTicketServices") @Bean(name = "casTicketServices")
public TicketServices casTicketServices( TicketServices casTicketServices(
@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,
JdbcTemplate jdbcTemplate, JdbcTemplate jdbcTemplate,
@ -61,7 +61,7 @@ public class CasAutoConfiguration implements InitializingBean {
* @return casTicketServices * @return casTicketServices
*/ */
@Bean(name = "casTicketGrantingTicketServices") @Bean(name = "casTicketGrantingTicketServices")
public TicketServices casTicketGrantingTicketServices( TicketServices casTicketGrantingTicketServices(
@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,
JdbcTemplate jdbcTemplate, JdbcTemplate jdbcTemplate,
@ -71,7 +71,7 @@ public class CasAutoConfiguration implements InitializingBean {
} }
@Bean(name = "casProxyGrantingTicketServices") @Bean(name = "casProxyGrantingTicketServices")
public TicketServices casProxyGrantingTicketServices( TicketServices casProxyGrantingTicketServices(
@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,
JdbcTemplate jdbcTemplate, JdbcTemplate jdbcTemplate,

View File

@ -76,7 +76,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
private static final Logger _logger = LoggerFactory.getLogger(Oauth20AutoConfiguration.class); private static final Logger _logger = LoggerFactory.getLogger(Oauth20AutoConfiguration.class);
@Bean @Bean
public FilterRegistrationBean<Filter> tokenEndpointAuthenticationFilter() { FilterRegistrationBean<Filter> tokenEndpointAuthenticationFilter() {
_logger.debug("TokenEndpointAuthenticationFilter init "); _logger.debug("TokenEndpointAuthenticationFilter init ");
FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<>(); FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<>();
registration.setFilter(new TokenEndpointAuthenticationFilter()); registration.setFilter(new TokenEndpointAuthenticationFilter());
@ -94,7 +94,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* http://openid.net/specs/openid-connect-core-1_0.html#SelfIssued * http://openid.net/specs/openid-connect-core-1_0.html#SelfIssued
*/ */
@Bean(name = "oidcProviderMetadata") @Bean(name = "oidcProviderMetadata")
public OIDCProviderMetadataDetails oidcProviderMetadata( OIDCProviderMetadataDetails oidcProviderMetadata(
@Value("${maxkey.oidc.metadata.issuer}") @Value("${maxkey.oidc.metadata.issuer}")
String issuer, String issuer,
@Value("${maxkey.oidc.metadata.authorizationEndpoint}") @Value("${maxkey.oidc.metadata.authorizationEndpoint}")
@ -117,7 +117,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return * @return
*/ */
@Bean(name = "jwkSetKeyStore") @Bean(name = "jwkSetKeyStore")
public JWKSetKeyStore jwkSetKeyStore() { JWKSetKeyStore jwkSetKeyStore() {
JWKSetKeyStore jwkSetKeyStore = new JWKSetKeyStore(); JWKSetKeyStore jwkSetKeyStore = new JWKSetKeyStore();
ClassPathResource classPathResource = new ClassPathResource("/config/keystore.jwks"); ClassPathResource classPathResource = new ClassPathResource("/config/keystore.jwks");
jwkSetKeyStore.setLocation(classPathResource); jwkSetKeyStore.setLocation(classPathResource);
@ -133,10 +133,10 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
*/ */
@Bean(name = "jwtSignerValidationService") @Bean(name = "jwtSignerValidationService")
public DefaultJwtSigningAndValidationService jwtSignerValidationService( DefaultJwtSigningAndValidationService jwtSignerValidationService(
@Qualifier("jwkSetKeyStore") @Qualifier("jwkSetKeyStore")
JWKSetKeyStore jwkSetKeyStore) JWKSetKeyStore jwkSetKeyStore)
throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException { throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException {
DefaultJwtSigningAndValidationService jwtSignerValidationService = DefaultJwtSigningAndValidationService jwtSignerValidationService =
new DefaultJwtSigningAndValidationService(jwkSetKeyStore); new DefaultJwtSigningAndValidationService(jwkSetKeyStore);
jwtSignerValidationService.setDefaultSignerKeyId("maxkey_rsa"); jwtSignerValidationService.setDefaultSignerKeyId("maxkey_rsa");
@ -153,10 +153,10 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
*/ */
@Bean(name = "jwtEncryptionService") @Bean(name = "jwtEncryptionService")
public DefaultJwtEncryptionAndDecryptionService jwtEncryptionService( DefaultJwtEncryptionAndDecryptionService jwtEncryptionService(
@Qualifier("jwkSetKeyStore") @Qualifier("jwkSetKeyStore")
JWKSetKeyStore jwkSetKeyStore) JWKSetKeyStore jwkSetKeyStore)
throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException { throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException {
DefaultJwtEncryptionAndDecryptionService jwtEncryptionService = DefaultJwtEncryptionAndDecryptionService jwtEncryptionService =
new DefaultJwtEncryptionAndDecryptionService(jwkSetKeyStore); new DefaultJwtEncryptionAndDecryptionService(jwkSetKeyStore);
jwtEncryptionService.setDefaultAlgorithm(JWEAlgorithm.RSA_OAEP_256);//RSA1_5 jwtEncryptionService.setDefaultAlgorithm(JWEAlgorithm.RSA_OAEP_256);//RSA1_5
@ -171,7 +171,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return * @return
*/ */
@Bean(name = "tokenEnhancer") @Bean(name = "tokenEnhancer")
public OIDCIdTokenEnhancer tokenEnhancer( OIDCIdTokenEnhancer tokenEnhancer(
OIDCProviderMetadataDetails oidcProviderMetadata, OIDCProviderMetadataDetails oidcProviderMetadata,
ClientDetailsService oauth20JdbcClientDetailsService) { ClientDetailsService oauth20JdbcClientDetailsService) {
OIDCIdTokenEnhancer tokenEnhancer = new OIDCIdTokenEnhancer(); OIDCIdTokenEnhancer tokenEnhancer = new OIDCIdTokenEnhancer();
@ -180,6 +180,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
_logger.debug("OIDC IdToken Enhancer init."); _logger.debug("OIDC IdToken Enhancer init.");
return tokenEnhancer; return tokenEnhancer;
} }
//以上部分为了支持OpenID Connect 1.0 //以上部分为了支持OpenID Connect 1.0
@ -189,7 +190,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return oauth20AuthorizationCodeServices * @return oauth20AuthorizationCodeServices
*/ */
@Bean(name = "oauth20AuthorizationCodeServices") @Bean(name = "oauth20AuthorizationCodeServices")
public AuthorizationCodeServices oauth20AuthorizationCodeServices( AuthorizationCodeServices oauth20AuthorizationCodeServices(
@Value("${maxkey.server.persistence}") int persistence, @Value("${maxkey.server.persistence}") int persistence,
JdbcTemplate jdbcTemplate, JdbcTemplate jdbcTemplate,
RedisConnectionFactory redisConnFactory) { RedisConnectionFactory redisConnFactory) {
@ -203,7 +204,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return oauth20TokenStore * @return oauth20TokenStore
*/ */
@Bean(name = "oauth20TokenStore") @Bean(name = "oauth20TokenStore")
public TokenStore oauth20TokenStore( TokenStore oauth20TokenStore(
@Value("${maxkey.server.persistence}") int persistence, @Value("${maxkey.server.persistence}") int persistence,
JdbcTemplate jdbcTemplate, JdbcTemplate jdbcTemplate,
RedisConnectionFactory redisConnFactory) { RedisConnectionFactory redisConnFactory) {
@ -216,7 +217,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return converter * @return converter
*/ */
@Bean(name = "converter") @Bean(name = "converter")
public JwtAccessTokenConverter jwtAccessTokenConverter() { JwtAccessTokenConverter jwtAccessTokenConverter() {
JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter(); JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
_logger.debug("OAuth 2 Jwt AccessToken Converter init."); _logger.debug("OAuth 2 Jwt AccessToken Converter init.");
return jwtAccessTokenConverter; return jwtAccessTokenConverter;
@ -227,7 +228,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return oauth20JdbcClientDetailsService * @return oauth20JdbcClientDetailsService
*/ */
@Bean(name = "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); JdbcClientDetailsService clientDetailsService = new JdbcClientDetailsService(dataSource);
//clientDetailsService.setPasswordEncoder(passwordReciprocal); //clientDetailsService.setPasswordEncoder(passwordReciprocal);
_logger.debug("OAuth 2 Jdbc ClientDetails Service init."); _logger.debug("OAuth 2 Jdbc ClientDetails Service init.");
@ -239,7 +240,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return oauth20TokenServices * @return oauth20TokenServices
*/ */
@Bean(name = "oauth20TokenServices") @Bean(name = "oauth20TokenServices")
public DefaultTokenServices defaultTokenServices( DefaultTokenServices defaultTokenServices(
JdbcClientDetailsService oauth20JdbcClientDetailsService, JdbcClientDetailsService oauth20JdbcClientDetailsService,
TokenStore oauth20TokenStore, TokenStore oauth20TokenStore,
OIDCIdTokenEnhancer tokenEnhancer) { OIDCIdTokenEnhancer tokenEnhancer) {
@ -258,7 +259,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return oauth20ApprovalStore * @return oauth20ApprovalStore
*/ */
@Bean(name = "oauth20ApprovalStore") @Bean(name = "oauth20ApprovalStore")
public TokenApprovalStore tokenApprovalStore( TokenApprovalStore tokenApprovalStore(
TokenStore oauth20TokenStore) { TokenStore oauth20TokenStore) {
TokenApprovalStore tokenApprovalStore = new TokenApprovalStore(); TokenApprovalStore tokenApprovalStore = new TokenApprovalStore();
tokenApprovalStore.setTokenStore(oauth20TokenStore); tokenApprovalStore.setTokenStore(oauth20TokenStore);
@ -272,7 +273,7 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return oAuth2RequestFactory * @return oAuth2RequestFactory
*/ */
@Bean(name = "oAuth2RequestFactory") @Bean(name = "oAuth2RequestFactory")
public DefaultOAuth2RequestFactory oauth2RequestFactory( DefaultOAuth2RequestFactory oauth2RequestFactory(
JdbcClientDetailsService oauth20JdbcClientDetailsService) { JdbcClientDetailsService oauth20JdbcClientDetailsService) {
DefaultOAuth2RequestFactory oauth2RequestFactory = DefaultOAuth2RequestFactory oauth2RequestFactory =
new DefaultOAuth2RequestFactory(oauth20JdbcClientDetailsService); new DefaultOAuth2RequestFactory(oauth20JdbcClientDetailsService);
@ -285,11 +286,11 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return oauth20UserApprovalHandler * @return oauth20UserApprovalHandler
*/ */
@Bean(name = "oauth20UserApprovalHandler") @Bean(name = "oauth20UserApprovalHandler")
public OAuth20UserApprovalHandler oauth20UserApprovalHandler( OAuth20UserApprovalHandler oauth20UserApprovalHandler(
JdbcClientDetailsService oauth20JdbcClientDetailsService, JdbcClientDetailsService oauth20JdbcClientDetailsService,
DefaultOAuth2RequestFactory oAuth2RequestFactory, DefaultOAuth2RequestFactory oAuth2RequestFactory,
TokenApprovalStore oauth20ApprovalStore TokenApprovalStore oauth20ApprovalStore
) { ) {
OAuth20UserApprovalHandler userApprovalHandler = new OAuth20UserApprovalHandler(); OAuth20UserApprovalHandler userApprovalHandler = new OAuth20UserApprovalHandler();
userApprovalHandler.setApprovalStore(oauth20ApprovalStore); userApprovalHandler.setApprovalStore(oauth20ApprovalStore);
userApprovalHandler.setRequestFactory(oAuth2RequestFactory); userApprovalHandler.setRequestFactory(oAuth2RequestFactory);
@ -303,11 +304,11 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return oauth20UserAuthenticationManager * @return oauth20UserAuthenticationManager
*/ */
@Bean(name = "oauth20UserAuthenticationManager") @Bean(name = "oauth20UserAuthenticationManager")
public ProviderManager oauth20UserAuthenticationManager( ProviderManager oauth20UserAuthenticationManager(
@Qualifier("passwordEncoder") @Qualifier("passwordEncoder")
PasswordEncoder passwordEncoder, PasswordEncoder passwordEncoder,
LoginRepository loginRepository LoginRepository loginRepository
) { ) {
OAuth2UserDetailsService userDetailsService =new OAuth2UserDetailsService(); OAuth2UserDetailsService userDetailsService =new OAuth2UserDetailsService();
userDetailsService.setLoginRepository(loginRepository); userDetailsService.setLoginRepository(loginRepository);
@ -325,11 +326,11 @@ public class Oauth20AutoConfiguration implements InitializingBean {
* @return oauth20ClientAuthenticationManager * @return oauth20ClientAuthenticationManager
*/ */
@Bean(name = "oauth20ClientAuthenticationManager") @Bean(name = "oauth20ClientAuthenticationManager")
public ProviderManager oauth20ClientAuthenticationManager( ProviderManager oauth20ClientAuthenticationManager(
JdbcClientDetailsService oauth20JdbcClientDetailsService, JdbcClientDetailsService oauth20JdbcClientDetailsService,
@Qualifier("passwordReciprocal") @Qualifier("passwordReciprocal")
PasswordEncoder passwordReciprocal PasswordEncoder passwordReciprocal
) { ) {
ClientDetailsUserDetailsService cientDetailsUserDetailsService = ClientDetailsUserDetailsService cientDetailsUserDetailsService =
new ClientDetailsUserDetailsService(oauth20JdbcClientDetailsService); new ClientDetailsUserDetailsService(oauth20JdbcClientDetailsService);

View File

@ -67,7 +67,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @throws ConfigurationException * @throws ConfigurationException
*/ */
@Bean(name = "samlBootstrapInitializer") @Bean(name = "samlBootstrapInitializer")
public String samlBootstrapInitializer() throws ConfigurationException { String samlBootstrapInitializer() throws ConfigurationException {
org.opensaml.DefaultBootstrap.bootstrap(); org.opensaml.DefaultBootstrap.bootstrap();
return ""; return "";
} }
@ -77,7 +77,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return timeService * @return timeService
*/ */
@Bean(name = "timeService") @Bean(name = "timeService")
public TimeService TimeService() { TimeService TimeService() {
TimeService timeService = new TimeService(); TimeService timeService = new TimeService();
return timeService; return timeService;
} }
@ -87,7 +87,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return idService * @return idService
*/ */
@Bean(name = "idService") @Bean(name = "idService")
public IDService idService() { IDService idService() {
IDService idService = new IDService(); IDService idService = new IDService();
return idService; return idService;
} }
@ -97,7 +97,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return endpointGenerator * @return endpointGenerator
*/ */
@Bean(name = "endpointGenerator") @Bean(name = "endpointGenerator")
public EndpointGenerator endpointGenerator() { EndpointGenerator endpointGenerator() {
EndpointGenerator generator = new EndpointGenerator(); EndpointGenerator generator = new EndpointGenerator();
return generator; return generator;
} }
@ -107,8 +107,8 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return authnResponseGenerator * @return authnResponseGenerator
*/ */
@Bean(name = "authnResponseGenerator") @Bean(name = "authnResponseGenerator")
public AuthnResponseGenerator authnResponseGenerator(TimeService timeService,IDService idService, AuthnResponseGenerator authnResponseGenerator(TimeService timeService, IDService idService,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) { @Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
_logger.debug("issuerEntityName {}" , issuerEntityName); _logger.debug("issuerEntityName {}" , issuerEntityName);
AuthnResponseGenerator generator = new AuthnResponseGenerator(issuerEntityName,timeService,idService); AuthnResponseGenerator generator = new AuthnResponseGenerator(issuerEntityName,timeService,idService);
return generator; return generator;
@ -119,7 +119,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return issuerEntityName * @return issuerEntityName
*/ */
@Bean(name = "issuerEntityName") @Bean(name = "issuerEntityName")
public String issuerEntityName( String issuerEntityName(
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) { @Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
return issuerEntityName; return issuerEntityName;
} }
@ -129,7 +129,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return saml20Metadata * @return saml20Metadata
*/ */
@Bean(name = "saml20Metadata") @Bean(name = "saml20Metadata")
public Saml20Metadata saml20Metadata( Saml20Metadata saml20Metadata(
@Value("${maxkey.saml.v20.metadata.orgName}") String orgName, @Value("${maxkey.saml.v20.metadata.orgName}") String orgName,
@Value("${maxkey.saml.v20.metadata.orgDisplayName}") String orgDisplayName, @Value("${maxkey.saml.v20.metadata.orgDisplayName}") String orgDisplayName,
@Value("${maxkey.saml.v20.metadata.orgURL}") String orgURL, @Value("${maxkey.saml.v20.metadata.orgURL}") String orgURL,
@ -157,7 +157,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return samlValidaotrSuite * @return samlValidaotrSuite
*/ */
@Bean(name = "samlValidaotrSuite") @Bean(name = "samlValidaotrSuite")
public SAML2ValidatorSuite validatorSuite() { SAML2ValidatorSuite validatorSuite() {
SAML2ValidatorSuite validatorSuite = new SAML2ValidatorSuite(); SAML2ValidatorSuite validatorSuite = new SAML2ValidatorSuite();
return validatorSuite; return validatorSuite;
} }
@ -168,7 +168,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Bean(name = "mapBasedStorageService") @Bean(name = "mapBasedStorageService")
public MapBasedStorageService mapBasedStorageService() { MapBasedStorageService mapBasedStorageService() {
MapBasedStorageService mapBasedStorageService = new MapBasedStorageService(); MapBasedStorageService mapBasedStorageService = new MapBasedStorageService();
return mapBasedStorageService; return mapBasedStorageService;
} }
@ -179,9 +179,9 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @throws IOException * @throws IOException
* @throws VelocityException * @throws VelocityException
*/ */
@SuppressWarnings({ "deprecation"}) @SuppressWarnings({"deprecation"})
@Bean(name = "velocityEngine") @Bean(name = "velocityEngine")
public VelocityEngine velocityEngine() throws VelocityException, IOException { VelocityEngine velocityEngine() throws VelocityException, IOException {
VelocityEngineFactoryBean factory = new VelocityEngineFactoryBean(); VelocityEngineFactoryBean factory = new VelocityEngineFactoryBean();
factory.setPreferFileSystemAccess(false); factory.setPreferFileSystemAccess(false);
Properties velocityProperties = new Properties(); Properties velocityProperties = new Properties();
@ -197,8 +197,8 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return replayCache * @return replayCache
*/ */
@Bean(name = "replayCache") @Bean(name = "replayCache")
public ReplayCache replayCache(MapBasedStorageService<String, ReplayCacheEntry> mapBasedStorageService, ReplayCache replayCache(MapBasedStorageService<String, ReplayCacheEntry> mapBasedStorageService,
@Value("${maxkey.saml.v20.replay.cache.life.in.millis}") long duration) { @Value("${maxkey.saml.v20.replay.cache.life.in.millis}") long duration) {
ReplayCache replayCache = new ReplayCache(mapBasedStorageService,duration); ReplayCache replayCache = new ReplayCache(mapBasedStorageService,duration);
return replayCache; return replayCache;
} }
@ -208,7 +208,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return messageReplayRule * @return messageReplayRule
*/ */
@Bean(name = "messageReplayRule") @Bean(name = "messageReplayRule")
public MessageReplayRule messageReplayRule(ReplayCache replayCache) { MessageReplayRule messageReplayRule(ReplayCache replayCache) {
MessageReplayRule messageReplayRule = new MessageReplayRule(replayCache); MessageReplayRule messageReplayRule = new MessageReplayRule(replayCache);
return messageReplayRule; return messageReplayRule;
} }
@ -218,7 +218,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return samlParserPool * @return samlParserPool
*/ */
@Bean(name = "samlParserPool") @Bean(name = "samlParserPool")
public BasicParserPool samlParserPool( BasicParserPool samlParserPool(
@Value("${maxkey.saml.v20.max.parser.pool.size}") int maxPoolSize) { @Value("${maxkey.saml.v20.max.parser.pool.size}") int maxPoolSize) {
BasicParserPool samlParserPool = new BasicParserPool(); BasicParserPool samlParserPool = new BasicParserPool();
samlParserPool.setMaxPoolSize(maxPoolSize); samlParserPool.setMaxPoolSize(maxPoolSize);
@ -230,7 +230,7 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return issueInstantRule * @return issueInstantRule
*/ */
@Bean(name = "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.clock.skew.in.seconds}") int newClockSkew,
@Value("${maxkey.saml.v20.issue.instant.check.validity.time.in.seconds}") int newExpires) { @Value("${maxkey.saml.v20.issue.instant.check.validity.time.in.seconds}") int newExpires) {
IssueInstantRule decoder = new IssueInstantRule(newClockSkew,newExpires); IssueInstantRule decoder = new IssueInstantRule(newClockSkew,newExpires);
@ -243,8 +243,8 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return openHTTPPostSimpleSignDecoder * @return openHTTPPostSimpleSignDecoder
*/ */
@Bean(name = "openHTTPPostSimpleSignDecoder") @Bean(name = "openHTTPPostSimpleSignDecoder")
public OpenHTTPPostSimpleSignDecoder openHTTPPostSimpleSignDecoder(BasicParserPool samlParserPool, OpenHTTPPostSimpleSignDecoder openHTTPPostSimpleSignDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) { @Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPPostSimpleSignDecoder decoder = new OpenHTTPPostSimpleSignDecoder(samlParserPool); OpenHTTPPostSimpleSignDecoder decoder = new OpenHTTPPostSimpleSignDecoder(samlParserPool);
decoder.setReceiverEndpoint(receiverEndpoint); decoder.setReceiverEndpoint(receiverEndpoint);
return decoder; return decoder;
@ -255,8 +255,8 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return openHTTPPostDecoder * @return openHTTPPostDecoder
*/ */
@Bean(name = "openHTTPPostDecoder") @Bean(name = "openHTTPPostDecoder")
public OpenHTTPPostDecoder openHTTPPostDecoder(BasicParserPool samlParserPool, OpenHTTPPostDecoder openHTTPPostDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) { @Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPPostDecoder decoder = new OpenHTTPPostDecoder(samlParserPool); OpenHTTPPostDecoder decoder = new OpenHTTPPostDecoder(samlParserPool);
decoder.setReceiverEndpoint(receiverEndpoint); decoder.setReceiverEndpoint(receiverEndpoint);
return decoder; return decoder;
@ -267,8 +267,8 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return openHTTPRedirectDecoder * @return openHTTPRedirectDecoder
*/ */
@Bean(name = "openHTTPRedirectDecoder") @Bean(name = "openHTTPRedirectDecoder")
public OpenHTTPRedirectDecoder openHTTPRedirectDecoder(BasicParserPool samlParserPool, OpenHTTPRedirectDecoder openHTTPRedirectDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) { @Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPRedirectDecoder decoder = new OpenHTTPRedirectDecoder(samlParserPool); OpenHTTPRedirectDecoder decoder = new OpenHTTPRedirectDecoder(samlParserPool);
decoder.setReceiverEndpoint(receiverEndpoint); decoder.setReceiverEndpoint(receiverEndpoint);
return decoder; return decoder;
@ -279,8 +279,8 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return extractPostBindingAdapter * @return extractPostBindingAdapter
*/ */
@Bean(name = "extractPostBindingAdapter") @Bean(name = "extractPostBindingAdapter")
public ExtractPostBindingAdapter extractPostBindingAdapter(OpenHTTPPostDecoder openHTTPPostDecoder, ExtractPostBindingAdapter extractPostBindingAdapter(OpenHTTPPostDecoder openHTTPPostDecoder,
@Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader,IssueInstantRule issueInstantRule,MessageReplayRule messageReplayRule) { @Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader, IssueInstantRule issueInstantRule, MessageReplayRule messageReplayRule) {
ExtractPostBindingAdapter adapter = new ExtractPostBindingAdapter(openHTTPPostDecoder); ExtractPostBindingAdapter adapter = new ExtractPostBindingAdapter(openHTTPPostDecoder);
adapter.setIssueInstantRule(issueInstantRule); adapter.setIssueInstantRule(issueInstantRule);
adapter.setKeyStoreLoader(keyStoreLoader); adapter.setKeyStoreLoader(keyStoreLoader);
@ -293,8 +293,8 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return extractRedirectBindingAdapter * @return extractRedirectBindingAdapter
*/ */
@Bean(name = "extractRedirectBindingAdapter") @Bean(name = "extractRedirectBindingAdapter")
public ExtractRedirectBindingAdapter extractRedirectBindingAdapter(OpenHTTPRedirectDecoder openHTTPRedirectDecoder, ExtractRedirectBindingAdapter extractRedirectBindingAdapter(OpenHTTPRedirectDecoder openHTTPRedirectDecoder,
@Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader,IssueInstantRule issueInstantRule,MessageReplayRule messageReplayRule) { @Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader, IssueInstantRule issueInstantRule, MessageReplayRule messageReplayRule) {
ExtractRedirectBindingAdapter adapter = new ExtractRedirectBindingAdapter(openHTTPRedirectDecoder); ExtractRedirectBindingAdapter adapter = new ExtractRedirectBindingAdapter(openHTTPRedirectDecoder);
adapter.setIssueInstantRule(issueInstantRule); adapter.setIssueInstantRule(issueInstantRule);
adapter.setKeyStoreLoader(keyStoreLoader); adapter.setKeyStoreLoader(keyStoreLoader);
@ -308,8 +308,8 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return postSimpleSignBindingAdapter * @return postSimpleSignBindingAdapter
*/ */
@Bean(name = "postSimpleSignBindingAdapter") @Bean(name = "postSimpleSignBindingAdapter")
public PostSimpleSignBindingAdapter postSimpleSignBindingAdapter(VelocityEngine velocityEngine, PostSimpleSignBindingAdapter postSimpleSignBindingAdapter(VelocityEngine velocityEngine,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) { @Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
PostSimpleSignBindingAdapter adapter = new PostSimpleSignBindingAdapter(); PostSimpleSignBindingAdapter adapter = new PostSimpleSignBindingAdapter();
adapter.setVelocityEngine(velocityEngine); adapter.setVelocityEngine(velocityEngine);
adapter.setIssuerEntityName(issuerEntityName); adapter.setIssuerEntityName(issuerEntityName);
@ -321,8 +321,8 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return postBindingAdapter * @return postBindingAdapter
*/ */
@Bean(name = "postBindingAdapter") @Bean(name = "postBindingAdapter")
public PostBindingAdapter postBindingAdapter(VelocityEngine velocityEngine, PostBindingAdapter postBindingAdapter(VelocityEngine velocityEngine,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) { @Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
PostBindingAdapter adapter = new PostBindingAdapter(); PostBindingAdapter adapter = new PostBindingAdapter();
adapter.setVelocityEngine(velocityEngine); adapter.setVelocityEngine(velocityEngine);
adapter.setIssuerEntityName(issuerEntityName); adapter.setIssuerEntityName(issuerEntityName);

View File

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

View File

@ -36,7 +36,7 @@ public class OneTimePasswordAutoConfiguration {
@Bean(name = "mailOtpAuthnService") @Bean(name = "mailOtpAuthnService")
public MailOtpAuthnService mailOtpAuthnService( MailOtpAuthnService mailOtpAuthnService(
@Value("${maxkey.server.persistence}") int persistence, @Value("${maxkey.server.persistence}") int persistence,
CnfEmailSendersService emailSendersService, CnfEmailSendersService emailSendersService,
RedisConnectionFactory redisConnFactory) { RedisConnectionFactory redisConnFactory) {

View File

@ -36,7 +36,7 @@ public class SmsAutoConfiguration {
@Bean(name = "smsOtpAuthnService") @Bean(name = "smsOtpAuthnService")
public SmsOtpAuthnService smsOtpAuthnService( SmsOtpAuthnService smsOtpAuthnService(
@Value("${maxkey.server.persistence}") int persistence, @Value("${maxkey.server.persistence}") int persistence,
CnfSmsProviderService smsProviderService, CnfSmsProviderService smsProviderService,
CnfEmailSendersService emailSendersService, CnfEmailSendersService emailSendersService,

View File

@ -58,17 +58,17 @@ public class ApplicationAutoConfiguration {
static final Logger _logger = LoggerFactory.getLogger(ApplicationAutoConfiguration.class); static final Logger _logger = LoggerFactory.getLogger(ApplicationAutoConfiguration.class);
@Bean @Bean
public PasswordReciprocal passwordReciprocal() { PasswordReciprocal passwordReciprocal() {
return new PasswordReciprocal(); return new PasswordReciprocal();
} }
@Bean @Bean
public DataSourceTransactionManager transactionManager(DataSource dataSource) { DataSourceTransactionManager transactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource); return new DataSourceTransactionManager(dataSource);
} }
@Bean @Bean
public InstitutionsRepository institutionsRepository(JdbcTemplate jdbcTemplate) { InstitutionsRepository institutionsRepository(JdbcTemplate jdbcTemplate) {
return new InstitutionsRepository(jdbcTemplate); return new InstitutionsRepository(jdbcTemplate);
} }
@ -77,8 +77,8 @@ public class ApplicationAutoConfiguration {
* @return * @return
*/ */
@Bean @Bean
public PasswordEncoder passwordEncoder( PasswordEncoder passwordEncoder(
@Value("${maxkey.crypto.password.encoder:bcrypt}") String idForEncode) { @Value("${maxkey.crypto.password.encoder:bcrypt}") String idForEncode) {
Map<String ,PasswordEncoder > encoders = new HashMap<>(); Map<String ,PasswordEncoder > encoders = new HashMap<>();
encoders.put("bcrypt", new BCryptPasswordEncoder()); encoders.put("bcrypt", new BCryptPasswordEncoder());
encoders.put("plain", NoOpPasswordEncoder.getInstance()); encoders.put("plain", NoOpPasswordEncoder.getInstance());
@ -117,7 +117,7 @@ public class ApplicationAutoConfiguration {
* @return * @return
*/ */
@Bean @Bean
public KeyStoreLoader keyStoreLoader( KeyStoreLoader keyStoreLoader(
@Value("${maxkey.saml.v20.idp.issuing.entity.id}") String entityName, @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.password}") String keystorePassword,
@Value("${maxkey.saml.v20.idp.keystore}") Resource keystoreFile) { @Value("${maxkey.saml.v20.idp.keystore}") Resource keystoreFile) {
@ -133,7 +133,7 @@ public class ApplicationAutoConfiguration {
* @return * @return
*/ */
@Bean @Bean
public KeyStoreLoader serviceProviderKeyStoreLoader( KeyStoreLoader serviceProviderKeyStoreLoader(
@Value("${maxkey.saml.v20.sp.issuing.entity.id}") String entityName, @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.password}") String keystorePassword,
@Value("${maxkey.saml.v20.sp.keystore}") Resource keystoreFile) { @Value("${maxkey.saml.v20.sp.keystore}") Resource keystoreFile) {
@ -149,7 +149,7 @@ public class ApplicationAutoConfiguration {
* @return * @return
*/ */
@Bean @Bean
public String spIssuingEntityName( String spIssuingEntityName(
@Value("${maxkey.saml.v20.sp.issuing.entity.id}") String spIssuingEntityName) { @Value("${maxkey.saml.v20.sp.issuing.entity.id}") String spIssuingEntityName) {
return spIssuingEntityName; return spIssuingEntityName;
} }
@ -159,7 +159,7 @@ public class ApplicationAutoConfiguration {
* @return * @return
*/ */
@Bean @Bean
public IdGenerator idGenerator( IdGenerator idGenerator(
@Value("${maxkey.id.strategy:SnowFlake}") String strategy, @Value("${maxkey.id.strategy:SnowFlake}") String strategy,
@Value("${maxkey.id.datacenterId:0}") int datacenterId, @Value("${maxkey.id.datacenterId:0}") int datacenterId,
@Value("${maxkey.id.machineId:0}") int machineId) { @Value("${maxkey.id.machineId:0}") int machineId) {
@ -172,9 +172,9 @@ public class ApplicationAutoConfiguration {
@Bean @Bean
public MomentaryService momentaryService( MomentaryService momentaryService(
RedisConnectionFactory redisConnFactory, RedisConnectionFactory redisConnFactory,
@Value("${maxkey.server.persistence}") int persistence) { @Value("${maxkey.server.persistence}") int persistence) {
MomentaryService momentaryService; MomentaryService momentaryService;
if (persistence == ConstsPersistence.REDIS) { if (persistence == ConstsPersistence.REDIS) {
momentaryService = new RedisMomentaryService(redisConnFactory); momentaryService = new RedisMomentaryService(redisConnFactory);

View File

@ -79,8 +79,8 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
* messageSource . * messageSource .
* @return messageSource * @return messageSource
*/ */
@Bean (name = "messageSource") @Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource( ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource(
@Value("${spring.messages.basename:classpath:messages/message}") @Value("${spring.messages.basename:classpath:messages/message}")
String messagesBasename) { String messagesBasename) {
_logger.debug("Basename {}" , messagesBasename); _logger.debug("Basename {}" , messagesBasename);
@ -97,8 +97,8 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
* @return localeChangeInterceptor * @return localeChangeInterceptor
*/ */
//@Primary //@Primary
@Bean (name = "localeChangeInterceptor") @Bean(name = "localeChangeInterceptor")
public LocaleChangeInterceptor localeChangeInterceptor() { LocaleChangeInterceptor localeChangeInterceptor() {
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("language"); localeChangeInterceptor.setParamName("language");
return localeChangeInterceptor; return localeChangeInterceptor;
@ -108,8 +108,8 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
* handlerMapping . * handlerMapping .
* @return handlerMapping * @return handlerMapping
*/ */
@Bean (name = "handlerMapping") @Bean(name = "handlerMapping")
public RequestMappingHandlerMapping requestMappingHandlerMapping( RequestMappingHandlerMapping requestMappingHandlerMapping(
LocaleChangeInterceptor localeChangeInterceptor) { LocaleChangeInterceptor localeChangeInterceptor) {
RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping(); RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping();
requestMappingHandlerMapping.setInterceptors(localeChangeInterceptor); requestMappingHandlerMapping.setInterceptors(localeChangeInterceptor);
@ -120,8 +120,8 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
* jaxb2Marshaller . * jaxb2Marshaller .
* @return jaxb2Marshaller * @return jaxb2Marshaller
*/ */
@Bean (name = "jaxb2Marshaller") @Bean(name = "jaxb2Marshaller")
public 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;
@ -131,8 +131,8 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
* marshallingHttpMessageConverter . * marshallingHttpMessageConverter .
* @return marshallingHttpMessageConverter * @return marshallingHttpMessageConverter
*/ */
@Bean (name = "marshallingHttpMessageConverter") @Bean(name = "marshallingHttpMessageConverter")
public MarshallingHttpMessageConverter marshallingHttpMessageConverter( MarshallingHttpMessageConverter marshallingHttpMessageConverter(
Jaxb2Marshaller jaxb2Marshaller) { Jaxb2Marshaller jaxb2Marshaller) {
MarshallingHttpMessageConverter marshallingHttpMessageConverter = new MarshallingHttpMessageConverter(); MarshallingHttpMessageConverter marshallingHttpMessageConverter = new MarshallingHttpMessageConverter();
marshallingHttpMessageConverter.setMarshaller(jaxb2Marshaller); marshallingHttpMessageConverter.setMarshaller(jaxb2Marshaller);
@ -150,8 +150,8 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
* mappingJacksonHttpMessageConverter . * mappingJacksonHttpMessageConverter .
* @return mappingJacksonHttpMessageConverter * @return mappingJacksonHttpMessageConverter
*/ */
@Bean (name = "mappingJacksonHttpMessageConverter") @Bean(name = "mappingJacksonHttpMessageConverter")
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() { MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter = new MappingJackson2HttpMessageConverter(); MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter = new MappingJackson2HttpMessageConverter();
ArrayList<MediaType> mediaTypesList = new ArrayList<>(); ArrayList<MediaType> mediaTypesList = new ArrayList<>();
mediaTypesList.add(MediaType.APPLICATION_JSON); mediaTypesList.add(MediaType.APPLICATION_JSON);
@ -176,10 +176,10 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
*/ */
@Bean(name = "cookieLocaleResolver") @Bean(name = "cookieLocaleResolver")
public LocaleResolver cookieLocaleResolver( LocaleResolver cookieLocaleResolver(
@Value("${maxkey.server.domain:maxkey.top}") @Value("${maxkey.server.domain:maxkey.top}")
String domainName String domainName
) { ) {
_logger.debug("DomainName {}" , domainName); _logger.debug("DomainName {}" , domainName);
CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver("mxk_locale"); CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver("mxk_locale");
cookieLocaleResolver.setCookieDomain(domainName); cookieLocaleResolver.setCookieDomain(domainName);
@ -192,9 +192,9 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
* requestMappingHandlerAdapter . * requestMappingHandlerAdapter .
* @return requestMappingHandlerAdapter * @return requestMappingHandlerAdapter
*/ */
@Bean (name = "addConverterRequestMappingHandlerAdapter") @Bean(name = "addConverterRequestMappingHandlerAdapter")
public RequestMappingHandlerAdapter requestMappingHandlerAdapter( RequestMappingHandlerAdapter requestMappingHandlerAdapter(
@Qualifier("mappingJacksonHttpMessageConverter") @Qualifier("mappingJacksonHttpMessageConverter")
MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter, MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter,
MarshallingHttpMessageConverter marshallingHttpMessageConverter, MarshallingHttpMessageConverter marshallingHttpMessageConverter,
StringHttpMessageConverter stringHttpMessageConverter, StringHttpMessageConverter stringHttpMessageConverter,
@ -217,9 +217,9 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
* restTemplate . * restTemplate .
* @return restTemplate * @return restTemplate
*/ */
@Bean (name = "restTemplate") @Bean(name = "restTemplate")
public RestTemplate restTemplate( RestTemplate restTemplate(
@Qualifier("mappingJacksonHttpMessageConverter") @Qualifier("mappingJacksonHttpMessageConverter")
MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter, MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter,
MarshallingHttpMessageConverter marshallingHttpMessageConverter) { MarshallingHttpMessageConverter marshallingHttpMessageConverter) {
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
@ -236,7 +236,7 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
* @return webServerFactoryCustomizer * @return webServerFactoryCustomizer
*/ */
@Bean @Bean
public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer() { WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer() {
return new WebServerFactoryCustomizer<ConfigurableWebServerFactory>() { return new WebServerFactoryCustomizer<ConfigurableWebServerFactory>() {
@Override @Override
public void customize(ConfigurableWebServerFactory factory) { public void customize(ConfigurableWebServerFactory factory) {
@ -253,13 +253,13 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
} }
@Bean @Bean
public SecurityContextHolderAwareRequestFilter securityContextHolderAwareRequestFilter() { SecurityContextHolderAwareRequestFilter securityContextHolderAwareRequestFilter() {
_logger.debug("securityContextHolderAwareRequestFilter init "); _logger.debug("securityContextHolderAwareRequestFilter init ");
return new SecurityContextHolderAwareRequestFilter(); return new SecurityContextHolderAwareRequestFilter();
} }
@Bean @Bean
public FilterRegistrationBean<CorsFilter> corsFilter() { FilterRegistrationBean<CorsFilter> corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration corsConfiguration = new CorsConfiguration(); CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.setAllowCredentials(true); corsConfiguration.setAllowCredentials(true);
@ -275,7 +275,7 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
} }
@Bean @Bean
public FilterRegistrationBean<Filter> delegatingFilterProxy() { FilterRegistrationBean<Filter> delegatingFilterProxy() {
_logger.debug("delegatingFilterProxy init for /* "); _logger.debug("delegatingFilterProxy init for /* ");
FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean<>(); FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(new DelegatingFilterProxy("securityContextHolderAwareRequestFilter")); registrationBean.setFilter(new DelegatingFilterProxy("securityContextHolderAwareRequestFilter"));
@ -288,7 +288,7 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
} }
@Bean @Bean
public FilterRegistrationBean<Filter> webXssRequestFilter() { FilterRegistrationBean<Filter> webXssRequestFilter() {
_logger.debug("webXssRequestFilter init for /* "); _logger.debug("webXssRequestFilter init for /* ");
FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean<>(new WebXssRequestFilter()); FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean<>(new WebXssRequestFilter());
registrationBean.addUrlPatterns("/*"); registrationBean.addUrlPatterns("/*");
@ -298,9 +298,9 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
} }
@Bean @Bean
public FilterRegistrationBean<Filter> webInstRequestFilter( FilterRegistrationBean<Filter> webInstRequestFilter(
InstitutionsRepository institutionsRepository, InstitutionsRepository institutionsRepository,
ApplicationConfig applicationConfig) { ApplicationConfig applicationConfig) {
_logger.debug("WebInstRequestFilter init for /* "); _logger.debug("WebInstRequestFilter init for /* ");
FilterRegistrationBean<Filter> registrationBean = FilterRegistrationBean<Filter> registrationBean =
new FilterRegistrationBean<>(new WebInstRequestFilter(institutionsRepository,applicationConfig)); new FilterRegistrationBean<>(new WebInstRequestFilter(institutionsRepository,applicationConfig));

View File

@ -42,7 +42,7 @@ public class RedisAutoConfiguration {
* @return RedisConnectionFactory * @return RedisConnectionFactory
*/ */
@Bean @Bean
public RedisConnectionFactory redisConnFactory( RedisConnectionFactory redisConnFactory(
@Value("${spring.redis.host}") @Value("${spring.redis.host}")
String host, String host,
@Value("${spring.redis.port:6379}") @Value("${spring.redis.port:6379}")

View File

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

View File

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

View File

@ -79,7 +79,7 @@ public class MaxKeyConfig {
@Bean @Bean
public OtpKeyUriFormat otpKeyUriFormat( OtpKeyUriFormat otpKeyUriFormat(
@Value("${maxkey.otp.policy.type:totp}") @Value("${maxkey.otp.policy.type:totp}")
String type, String type,
@Value("${maxkey.otp.policy.domain:MaxKey.top}") @Value("${maxkey.otp.policy.domain:MaxKey.top}")
@ -98,13 +98,13 @@ public class MaxKeyConfig {
//可以在此实现其他的登陆认证方式请实现AbstractAuthenticationRealm //可以在此实现其他的登陆认证方式请实现AbstractAuthenticationRealm
@Bean @Bean
public JdbcAuthenticationRealm authenticationRealm( JdbcAuthenticationRealm authenticationRealm(
@Qualifier("passwordEncoder") PasswordEncoder passwordEncoder, @Qualifier("passwordEncoder") PasswordEncoder passwordEncoder,
PasswordPolicyValidator passwordPolicyValidator, PasswordPolicyValidator passwordPolicyValidator,
LoginRepository loginService, LoginRepository loginService,
LoginHistoryRepository loginHistoryService, LoginHistoryRepository loginHistoryService,
UserInfoService userInfoService, UserInfoService userInfoService,
IpLocationParser ipLocationParser, IpLocationParser ipLocationParser,
JdbcTemplate jdbcTemplate, JdbcTemplate jdbcTemplate,
MailOtpAuthnService otpAuthnService, MailOtpAuthnService otpAuthnService,
CnfLdapContextService ldapContextService) { CnfLdapContextService ldapContextService) {
@ -121,8 +121,8 @@ public class MaxKeyConfig {
); );
} }
@Bean @Bean
public TimeBasedOtpAuthn timeBasedOtpAuthn( TimeBasedOtpAuthn timeBasedOtpAuthn(
@Value("${maxkey.otp.policy.digits:6}") @Value("${maxkey.otp.policy.digits:6}")
int digits, int digits,
@Value("${maxkey.otp.policy.period:30}") @Value("${maxkey.otp.policy.period:30}")
@ -133,8 +133,8 @@ public class MaxKeyConfig {
} }
@Bean @Bean
public AbstractOtpAuthn tfaOtpAuthn( AbstractOtpAuthn tfaOtpAuthn(
@Value("${maxkey.login.mfa.type}")String mfaType, @Value("${maxkey.login.mfa.type}") String mfaType,
@Value("${maxkey.otp.policy.digits:6}") @Value("${maxkey.otp.policy.digits:6}")
int digits, int digits,
@Value("${maxkey.otp.policy.period:30}") @Value("${maxkey.otp.policy.period:30}")
@ -154,7 +154,7 @@ public class MaxKeyConfig {
} }
@Bean @Bean
public MailOtpAuthn mailOtpAuthn( MailOtpAuthn mailOtpAuthn(
EmailConfig emailConfig, EmailConfig emailConfig,
@Value("${spring.mail.properties.mailotp.message.subject}") @Value("${spring.mail.properties.mailotp.message.subject}")
String messageSubject, String messageSubject,
@ -164,7 +164,7 @@ public class MaxKeyConfig {
int messageValidity, int messageValidity,
@Value("${spring.mail.properties.mailotp.message.type}") @Value("${spring.mail.properties.mailotp.message.type}")
String messageType String messageType
) { ) {
if(messageType!= null && messageType.equalsIgnoreCase("html")) { if(messageType!= null && messageType.equalsIgnoreCase("html")) {
Resource resource = new ClassPathResource("messages/email/forgotpassword.html"); Resource resource = new ClassPathResource("messages/email/forgotpassword.html");
try { try {
@ -187,7 +187,7 @@ public class MaxKeyConfig {
@Bean @Bean
public RemoteKerberosService kerberosService( RemoteKerberosService kerberosService(
@Value("${maxkey.login.kerberos.default.userdomain}") @Value("${maxkey.login.kerberos.default.userdomain}")
String userDomain, String userDomain,
@Value("${maxkey.login.kerberos.default.fulluserdomain}") @Value("${maxkey.login.kerberos.default.fulluserdomain}")
@ -196,7 +196,7 @@ public class MaxKeyConfig {
String crypto, String crypto,
@Value("${maxkey.login.kerberos.default.redirecturi}") @Value("${maxkey.login.kerberos.default.redirecturi}")
String redirectUri String redirectUri
) { ) {
RemoteKerberosService kerberosService = new RemoteKerberosService(); RemoteKerberosService kerberosService = new RemoteKerberosService();
KerberosProxy kerberosProxy = new KerberosProxy(); KerberosProxy kerberosProxy = new KerberosProxy();

View File

@ -37,17 +37,17 @@ import org.springframework.security.crypto.password.PasswordEncoder;
public class MaxKeyMgtConfig { public class MaxKeyMgtConfig {
private static final Logger logger = LoggerFactory.getLogger(MaxKeyMgtConfig.class); private static final Logger logger = LoggerFactory.getLogger(MaxKeyMgtConfig.class);
//authenticationRealm for MaxKeyMgtApplication //authenticationRealm for MaxKeyMgtApplication
@Bean @Bean
public JdbcAuthenticationRealm authenticationRealm( JdbcAuthenticationRealm authenticationRealm(
@Qualifier("passwordEncoder") @Qualifier("passwordEncoder")
PasswordEncoder passwordEncoder, PasswordEncoder passwordEncoder,
PasswordPolicyValidator passwordPolicyValidator, PasswordPolicyValidator passwordPolicyValidator,
LoginRepository loginRepository, LoginRepository loginRepository,
LoginHistoryRepository loginHistoryRepository, LoginHistoryRepository loginHistoryRepository,
UserInfoService userInfoService, UserInfoService userInfoService,
IpLocationParser ipLocationParser, IpLocationParser ipLocationParser,
JdbcTemplate jdbcTemplate) { JdbcTemplate jdbcTemplate) {
JdbcAuthenticationRealm authenticationRealm = new JdbcAuthenticationRealm( JdbcAuthenticationRealm authenticationRealm = new JdbcAuthenticationRealm(
passwordEncoder, passwordEncoder,
@ -62,8 +62,8 @@ public class MaxKeyMgtConfig {
return authenticationRealm; return authenticationRealm;
} }
@Bean @Bean
public AbstractOtpAuthn timeBasedOtpAuthn() { AbstractOtpAuthn timeBasedOtpAuthn() {
AbstractOtpAuthn tfaOtpAuthn = new TimeBasedOtpAuthn(); AbstractOtpAuthn tfaOtpAuthn = new TimeBasedOtpAuthn();
logger.debug("TimeBasedOtpAuthn inited."); logger.debug("TimeBasedOtpAuthn inited.");
return tfaOtpAuthn; return tfaOtpAuthn;

View File

@ -42,9 +42,9 @@ public class MaxKeyMgtListenerConfig {
private static final Logger logger = LoggerFactory.getLogger(MaxKeyMgtListenerConfig.class); private static final Logger logger = LoggerFactory.getLogger(MaxKeyMgtListenerConfig.class);
@Bean @Bean
public String sessionListenerAdapter( String sessionListenerAdapter(
Scheduler scheduler, Scheduler scheduler,
SessionManager sessionManager) throws SchedulerException { SessionManager sessionManager) throws SchedulerException {
new ScheduleAdapterBuilder() new ScheduleAdapterBuilder()
.setScheduler(scheduler) .setScheduler(scheduler)
.setCron("0 0/10 * * * ?") .setCron("0 0/10 * * * ?")
@ -56,9 +56,9 @@ public class MaxKeyMgtListenerConfig {
} }
@Bean @Bean
public String reorgDeptListenerAdapter( String reorgDeptListenerAdapter(
Scheduler scheduler, Scheduler scheduler,
OrganizationsService organizationsService) throws SchedulerException { OrganizationsService organizationsService) throws SchedulerException {
new ScheduleAdapterBuilder() new ScheduleAdapterBuilder()
.setScheduler(scheduler) .setScheduler(scheduler)
.setCron("0 0/30 * * * ?") .setCron("0 0/30 * * * ?")
@ -70,11 +70,11 @@ public class MaxKeyMgtListenerConfig {
} }
@Bean @Bean
public String dynamicGroupsListenerAdapter( String dynamicGroupsListenerAdapter(
Scheduler scheduler, Scheduler scheduler,
GroupsService groupsService, GroupsService groupsService,
@Value("${maxkey.job.cron.schedule}") String cronSchedule @Value("${maxkey.job.cron.schedule}") String cronSchedule
) throws SchedulerException { ) throws SchedulerException {
new ScheduleAdapterBuilder() new ScheduleAdapterBuilder()
.setScheduler(scheduler) .setScheduler(scheduler)
.setCron(cronSchedule) .setCron(cronSchedule)
@ -87,11 +87,11 @@ public class MaxKeyMgtListenerConfig {
} }
@Bean @Bean
public String provisioningRunnerThread( String provisioningRunnerThread(
ConnectorsService connectorsService, ConnectorsService connectorsService,
JdbcTemplate jdbcTemplate, JdbcTemplate jdbcTemplate,
ApplicationConfig applicationConfig ApplicationConfig applicationConfig
) { ) {
if(applicationConfig.isProvisionSupport()) { if(applicationConfig.isProvisionSupport()) {
ProvisioningRunner runner = new ProvisioningRunner(connectorsService,jdbcTemplate); ProvisioningRunner runner = new ProvisioningRunner(connectorsService,jdbcTemplate);
ProvisioningRunnerThread runnerThread = new ProvisioningRunnerThread(runner); ProvisioningRunnerThread runnerThread = new ProvisioningRunnerThread(runner);

View File

@ -47,8 +47,8 @@ public class Oauth20ClientAutoConfiguration {
private static final Logger logger = LoggerFactory.getLogger(Oauth20ClientAutoConfiguration.class); private static final Logger logger = LoggerFactory.getLogger(Oauth20ClientAutoConfiguration.class);
@Bean @Bean
public JdbcClientDetailsService oauth20JdbcClientDetailsService( JdbcClientDetailsService oauth20JdbcClientDetailsService(
DataSource dataSource , @Qualifier("passwordReciprocal") PasswordEncoder passwordReciprocal) { DataSource dataSource, @Qualifier("passwordReciprocal") PasswordEncoder passwordReciprocal) {
JdbcClientDetailsService clientDetailsService = new JdbcClientDetailsService(dataSource); JdbcClientDetailsService clientDetailsService = new JdbcClientDetailsService(dataSource);
//clientDetailsService.setPasswordEncoder(passwordReciprocal); //clientDetailsService.setPasswordEncoder(passwordReciprocal);
logger.debug("JdbcClientDetailsService inited."); logger.debug("JdbcClientDetailsService inited.");
@ -61,7 +61,7 @@ public class Oauth20ClientAutoConfiguration {
* @return oauth20TokenStore * @return oauth20TokenStore
*/ */
@Bean @Bean
public TokenStore oauth20TokenStore( TokenStore oauth20TokenStore(
@Value("${maxkey.server.persistence}") int persistence, @Value("${maxkey.server.persistence}") int persistence,
JdbcTemplate jdbcTemplate, JdbcTemplate jdbcTemplate,
RedisConnectionFactory jedisConnectionFactory) { RedisConnectionFactory jedisConnectionFactory) {
@ -82,7 +82,7 @@ public class Oauth20ClientAutoConfiguration {
* @return oauth20TokenServices * @return oauth20TokenServices
*/ */
@Bean @Bean
public DefaultTokenServices oauth20TokenServices( DefaultTokenServices oauth20TokenServices(
JdbcClientDetailsService oauth20JdbcClientDetailsService, JdbcClientDetailsService oauth20JdbcClientDetailsService,
TokenStore oauth20TokenStore) { TokenStore oauth20TokenStore) {
DefaultTokenServices tokenServices = new DefaultTokenServices(); DefaultTokenServices tokenServices = new DefaultTokenServices();
@ -97,11 +97,11 @@ public class Oauth20ClientAutoConfiguration {
* @return oauth20ClientAuthenticationManager * @return oauth20ClientAuthenticationManager
*/ */
@Bean @Bean
public ProviderManager oauth20ClientAuthenticationManager( ProviderManager oauth20ClientAuthenticationManager(
JdbcClientDetailsService oauth20JdbcClientDetailsService, JdbcClientDetailsService oauth20JdbcClientDetailsService,
@Qualifier("passwordReciprocal") @Qualifier("passwordReciprocal")
PasswordEncoder passwordReciprocal PasswordEncoder passwordReciprocal
) { ) {
ClientDetailsUserDetailsService cientDetailsUserDetailsService = ClientDetailsUserDetailsService cientDetailsUserDetailsService =
new ClientDetailsUserDetailsService(oauth20JdbcClientDetailsService); new ClientDetailsUserDetailsService(oauth20JdbcClientDetailsService);

View File

@ -37,17 +37,17 @@ import org.springframework.security.crypto.password.PasswordEncoder;
public class MaxKeyOpenApiConfig{ public class MaxKeyOpenApiConfig{
private static final Logger logger = LoggerFactory.getLogger(MaxKeyOpenApiConfig.class); private static final Logger logger = LoggerFactory.getLogger(MaxKeyOpenApiConfig.class);
//authenticationRealm for MaxKeyMgtApplication //authenticationRealm for MaxKeyMgtApplication
@Bean @Bean
public JdbcAuthenticationRealm authenticationRealm( JdbcAuthenticationRealm authenticationRealm(
@Qualifier("passwordEncoder") @Qualifier("passwordEncoder")
PasswordEncoder passwordEncoder, PasswordEncoder passwordEncoder,
PasswordPolicyValidator passwordPolicyValidator, PasswordPolicyValidator passwordPolicyValidator,
LoginRepository loginRepository, LoginRepository loginRepository,
LoginHistoryRepository loginHistoryRepository, LoginHistoryRepository loginHistoryRepository,
UserInfoService userInfoService, UserInfoService userInfoService,
IpLocationParser ipLocationParser, IpLocationParser ipLocationParser,
JdbcTemplate jdbcTemplate) { JdbcTemplate jdbcTemplate) {
JdbcAuthenticationRealm authenticationRealm = new JdbcAuthenticationRealm( JdbcAuthenticationRealm authenticationRealm = new JdbcAuthenticationRealm(
passwordEncoder, passwordEncoder,
@ -62,8 +62,8 @@ public class MaxKeyOpenApiConfig{
return authenticationRealm; return authenticationRealm;
} }
@Bean @Bean
public AbstractOtpAuthn timeBasedOtpAuthn() { AbstractOtpAuthn timeBasedOtpAuthn() {
AbstractOtpAuthn tfaOtpAuthn = new TimeBasedOtpAuthn(); AbstractOtpAuthn tfaOtpAuthn = new TimeBasedOtpAuthn();
logger.debug("TimeBasedOtpAuthn inited."); logger.debug("TimeBasedOtpAuthn inited.");
return tfaOtpAuthn; return tfaOtpAuthn;

View File

@ -47,7 +47,7 @@ public class Oauth20ClientAutoConfiguration {
private static final Logger logger = LoggerFactory.getLogger(Oauth20ClientAutoConfiguration.class); private static final Logger logger = LoggerFactory.getLogger(Oauth20ClientAutoConfiguration.class);
@Bean @Bean
public JdbcClientDetailsService oauth20JdbcClientDetailsService( JdbcClientDetailsService oauth20JdbcClientDetailsService(
DataSource dataSource, @Qualifier("passwordReciprocal") PasswordEncoder passwordReciprocal) { DataSource dataSource, @Qualifier("passwordReciprocal") PasswordEncoder passwordReciprocal) {
JdbcClientDetailsService clientDetailsService = new JdbcClientDetailsService(dataSource); JdbcClientDetailsService clientDetailsService = new JdbcClientDetailsService(dataSource);
//clientDetailsService.setPasswordEncoder(passwordReciprocal); //clientDetailsService.setPasswordEncoder(passwordReciprocal);
@ -61,7 +61,7 @@ public class Oauth20ClientAutoConfiguration {
* @return oauth20TokenStore * @return oauth20TokenStore
*/ */
@Bean @Bean
public TokenStore oauth20TokenStore( TokenStore oauth20TokenStore(
@Value("${maxkey.server.persistence}") int persistence, @Value("${maxkey.server.persistence}") int persistence,
JdbcTemplate jdbcTemplate, JdbcTemplate jdbcTemplate,
RedisConnectionFactory jedisConnectionFactory) { RedisConnectionFactory jedisConnectionFactory) {
@ -82,7 +82,7 @@ public class Oauth20ClientAutoConfiguration {
* @return oauth20TokenServices * @return oauth20TokenServices
*/ */
@Bean @Bean
public DefaultTokenServices oauth20TokenServices( DefaultTokenServices oauth20TokenServices(
JdbcClientDetailsService oauth20JdbcClientDetailsService, JdbcClientDetailsService oauth20JdbcClientDetailsService,
TokenStore oauth20TokenStore) { TokenStore oauth20TokenStore) {
DefaultTokenServices tokenServices = new DefaultTokenServices(); DefaultTokenServices tokenServices = new DefaultTokenServices();
@ -97,11 +97,11 @@ public class Oauth20ClientAutoConfiguration {
* @return oauth20ClientAuthenticationManager * @return oauth20ClientAuthenticationManager
*/ */
@Bean @Bean
public ProviderManager oauth20ClientAuthenticationManager( ProviderManager oauth20ClientAuthenticationManager(
JdbcClientDetailsService oauth20JdbcClientDetailsService, JdbcClientDetailsService oauth20JdbcClientDetailsService,
@Qualifier("passwordReciprocal") @Qualifier("passwordReciprocal")
PasswordEncoder passwordReciprocal PasswordEncoder passwordReciprocal
) { ) {
ClientDetailsUserDetailsService cientDetailsUserDetailsService = ClientDetailsUserDetailsService cientDetailsUserDetailsService =
new ClientDetailsUserDetailsService(oauth20JdbcClientDetailsService); new ClientDetailsUserDetailsService(oauth20JdbcClientDetailsService);

View File

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