diff --git a/maxkey-authentications/maxkey-authentication-core/build.gradle b/maxkey-authentications/maxkey-authentication-core/build.gradle index c00f8d9e2886afbce8703dab9795d10b557fba38..9c9624981f597730dc607ee0c063597d6ca953fd 100644 --- a/maxkey-authentications/maxkey-authentication-core/build.gradle +++ b/maxkey-authentications/maxkey-authentication-core/build.gradle @@ -11,5 +11,6 @@ dependencies { compile project(":maxkey-persistence") compile project(":maxkey-protocols:maxkey-protocol-oauth-2.0") compile project(":maxkey-protocols:maxkey-protocol-saml-2.0") + compile project(":maxkey-authentications:maxkey-authentication-otp") } \ No newline at end of file diff --git a/maxkey-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/LoginCredential.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/LoginCredential.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/LoginCredential.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/LoginCredential.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/RealmAuthenticationProvider.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/RealmAuthenticationProvider.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/RealmAuthenticationProvider.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/RealmAuthenticationProvider.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/SavedRequestAwareAuthenticationSuccessHandler.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/SavedRequestAwareAuthenticationSuccessHandler.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/SavedRequestAwareAuthenticationSuccessHandler.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/SavedRequestAwareAuthenticationSuccessHandler.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/SigninPrincipal.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/SigninPrincipal.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/SigninPrincipal.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/SigninPrincipal.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/online/InMemoryOnlineTicketServices.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/online/InMemoryOnlineTicketServices.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/online/InMemoryOnlineTicketServices.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/online/InMemoryOnlineTicketServices.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/online/OnlineTicket.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/online/OnlineTicket.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/online/OnlineTicket.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/online/OnlineTicket.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/online/OnlineTicketServices.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/online/OnlineTicketServices.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/online/OnlineTicketServices.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/online/OnlineTicketServices.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/online/RedisOnlineTicketServices.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/online/RedisOnlineTicketServices.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/online/RedisOnlineTicketServices.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/online/RedisOnlineTicketServices.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/realm/IAuthenticationServer.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/IAuthenticationServer.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/realm/IAuthenticationServer.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/IAuthenticationServer.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/realm/jdbc/DefaultJdbcAuthenticationRealm.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/jdbc/DefaultJdbcAuthenticationRealm.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/realm/jdbc/DefaultJdbcAuthenticationRealm.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/jdbc/DefaultJdbcAuthenticationRealm.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/support/jwt/JwtLoginService.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/jwt/JwtLoginService.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/support/jwt/JwtLoginService.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/jwt/JwtLoginService.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeService.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeService.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeService.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeService.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/InMemoryRemeberMeService.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/InMemoryRemeberMeService.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/InMemoryRemeberMeService.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/InMemoryRemeberMeService.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/JdbcRemeberMeService.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/JdbcRemeberMeService.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/JdbcRemeberMeService.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/JdbcRemeberMeService.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/RedisRemeberMeService.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/RedisRemeberMeService.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/RedisRemeberMeService.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/RedisRemeberMeService.java diff --git a/maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/RemeberMe.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/RemeberMe.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/RemeberMe.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/RemeberMe.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/AuthenticationAutoConfiguration.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/AuthenticationAutoConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..2a764dbaf229bc9427bc5c9e79ad5240539a7d2b --- /dev/null +++ b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/AuthenticationAutoConfiguration.java @@ -0,0 +1,180 @@ +/* + * Copyright [2020] [MaxKey of copyright http://www.maxkey.top] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.maxkey.autoconfigure; + +import java.util.HashMap; +import java.util.Map; +import javax.sql.DataSource; +import org.maxkey.authn.AbstractAuthenticationProvider; +import org.maxkey.authn.RealmAuthenticationProvider; +import org.maxkey.authn.SavedRequestAwareAuthenticationSuccessHandler; +import org.maxkey.authn.online.InMemoryOnlineTicketServices; +import org.maxkey.authn.online.OnlineTicketServices; +import org.maxkey.authn.online.RedisOnlineTicketServices; +import org.maxkey.authn.support.rememberme.AbstractRemeberMeService; +import org.maxkey.authn.support.rememberme.InMemoryRemeberMeService; +import org.maxkey.authn.support.rememberme.RedisRemeberMeService; +import org.maxkey.constants.ConstantsPersistence; +import org.maxkey.constants.ConstantsProperties; +import org.maxkey.crypto.password.LdapShaPasswordEncoder; +import org.maxkey.crypto.password.Md4PasswordEncoder; +import org.maxkey.crypto.password.NoOpPasswordEncoder; +import org.maxkey.crypto.password.MessageDigestPasswordEncoder; +import org.maxkey.crypto.password.SM3PasswordEncoder; +import org.maxkey.crypto.password.StandardPasswordEncoder; +import org.maxkey.persistence.db.PasswordPolicyValidator; +import org.maxkey.persistence.redis.RedisConnectionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.DelegatingPasswordEncoder; + +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder; +import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder; +import org.maxkey.persistence.db.LoginService; +import org.maxkey.persistence.db.LoginHistoryService; + + +@Configuration +@PropertySource(ConstantsProperties.applicationPropertySource) +@PropertySource(ConstantsProperties.maxKeyPropertySource) +public class AuthenticationAutoConfiguration implements InitializingBean { + private static final Logger _logger = + LoggerFactory.getLogger(AuthenticationAutoConfiguration.class); + + + @Bean(name = "savedRequestSuccessHandler") + public SavedRequestAwareAuthenticationSuccessHandler + savedRequestAwareAuthenticationSuccessHandler() { + return new SavedRequestAwareAuthenticationSuccessHandler(); + } + + @Bean(name = "authenticationProvider") + public AbstractAuthenticationProvider authenticationProvider() { + return new RealmAuthenticationProvider(); + } + + @Bean(name = "transactionManager") + public DataSourceTransactionManager transactionManager(DataSource dataSource) { + return new DataSourceTransactionManager(dataSource); + } + + @Bean(name = "passwordPolicyValidator") + public PasswordPolicyValidator passwordPolicyValidator(JdbcTemplate jdbcTemplate,MessageSource messageSource) { + return new PasswordPolicyValidator(jdbcTemplate,messageSource); + } + + @Bean(name = "loginService") + public LoginService LoginService(JdbcTemplate jdbcTemplate) { + return new LoginService(jdbcTemplate); + } + @Bean(name = "loginHistoryService") + public LoginHistoryService loginHistoryService(JdbcTemplate jdbcTemplate) { + return new LoginHistoryService(jdbcTemplate); + } + + + /** + * Authentication Password Encoder . + * @return + */ + @Bean(name = "passwordEncoder") + public PasswordEncoder passwordEncoder() { + String idForEncode = "bcrypt"; + Map encoders = new HashMap(); + encoders.put(idForEncode, new BCryptPasswordEncoder()); + encoders.put("plain", NoOpPasswordEncoder.getInstance()); + encoders.put("pbkdf2", new Pbkdf2PasswordEncoder()); + encoders.put("scrypt", new SCryptPasswordEncoder()); + //md + encoders.put("md4", new Md4PasswordEncoder()); + encoders.put("md5", new MessageDigestPasswordEncoder("MD5")); + //sha + encoders.put("sha1", new StandardPasswordEncoder("SHA-1","")); + encoders.put("sha256", new StandardPasswordEncoder()); + encoders.put("sha384", new StandardPasswordEncoder("SHA-384","")); + encoders.put("sha512", new StandardPasswordEncoder("SHA-512","")); + + encoders.put("sm3", new SM3PasswordEncoder()); + + encoders.put("ldap", new LdapShaPasswordEncoder()); + + //idForEncode is default for encoder + PasswordEncoder passwordEncoder = + new DelegatingPasswordEncoder(idForEncode, encoders); + + return passwordEncoder; + } + + /** + * remeberMeService . + * @return + */ + @Bean(name = "remeberMeService") + public AbstractRemeberMeService remeberMeService( + @Value("${config.server.persistence}") int persistence, + @Value("${config.login.remeberme.validity}") int validity, + JdbcTemplate jdbcTemplate, + RedisConnectionFactory redisConnFactory) { + AbstractRemeberMeService remeberMeService = null; + if (persistence == ConstantsPersistence.INMEMORY) { + remeberMeService = new InMemoryRemeberMeService(); + _logger.debug("InMemoryRemeberMeService"); + } else if (persistence == ConstantsPersistence.JDBC) { + //remeberMeService = new JdbcRemeberMeService(jdbcTemplate); + _logger.debug("JdbcRemeberMeService not support "); + } else if (persistence == ConstantsPersistence.REDIS) { + remeberMeService = new RedisRemeberMeService(redisConnFactory); + _logger.debug("RedisRemeberMeService"); + } + return remeberMeService; + } + + @Bean(name = "onlineTicketServices") + public OnlineTicketServices onlineTicketServices( + @Value("${config.server.persistence}") int persistence, + JdbcTemplate jdbcTemplate, + RedisConnectionFactory redisConnFactory) { + OnlineTicketServices onlineTicketServices = null; + if (persistence == ConstantsPersistence.INMEMORY) { + onlineTicketServices = new InMemoryOnlineTicketServices(); + _logger.debug("InMemoryOnlineTicketServices"); + } else if (persistence == ConstantsPersistence.JDBC) { + _logger.debug("OnlineTicketServices not support "); + } else if (persistence == ConstantsPersistence.REDIS) { + onlineTicketServices = new RedisOnlineTicketServices(redisConnFactory); + _logger.debug("RedisOnlineTicketServices"); + } + return onlineTicketServices; + } + + @Override + public void afterPropertiesSet() throws Exception { + // TODO Auto-generated method stub + + } +} diff --git a/maxkey-core/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java similarity index 100% rename from maxkey-core/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java diff --git a/maxkey-authentications/maxkey-authentication-social/build.gradle b/maxkey-authentications/maxkey-authentication-social/build.gradle index 5b42dda832c56133a024f106a8682a7120a333f7..434b886b16a51c63fa56f7f81dd9b7e5e3bf43b1 100644 --- a/maxkey-authentications/maxkey-authentication-social/build.gradle +++ b/maxkey-authentications/maxkey-authentication-social/build.gradle @@ -9,5 +9,6 @@ dependencies { compile project(":maxkey-common") compile project(":maxkey-core") compile project(":maxkey-persistence") + compile project(":maxkey-authentications:maxkey-authentication-core") } \ No newline at end of file diff --git a/maxkey-core/build.gradle b/maxkey-core/build.gradle index df55b93db8a7405a33b571ff465c9c87db449273..d8e8e15005bcdb4f494082ed4da8606e0d6e0b12 100644 --- a/maxkey-core/build.gradle +++ b/maxkey-core/build.gradle @@ -2,7 +2,6 @@ description = "maxkey-core" dependencies { compile project(":maxkey-common") - compile project(":maxkey-authentications:maxkey-authentication-otp") //local jars compile fileTree(dir: '../maxkey-lib/', include: '*/*.jar') diff --git a/maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java b/maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java index befc64a363dcea4708c931e686ea58ef82acf33f..145a98a4759e21f75064f84767d7307e6e104e88 100644 --- a/maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java +++ b/maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java @@ -23,17 +23,6 @@ import java.util.HashMap; import java.util.Map; import javax.sql.DataSource; - -import org.maxkey.authn.AbstractAuthenticationProvider; -import org.maxkey.authn.RealmAuthenticationProvider; -import org.maxkey.authn.SavedRequestAwareAuthenticationSuccessHandler; -import org.maxkey.authn.online.InMemoryOnlineTicketServices; -import org.maxkey.authn.online.OnlineTicketServices; -import org.maxkey.authn.online.RedisOnlineTicketServices; -import org.maxkey.authn.support.rememberme.AbstractRemeberMeService; -import org.maxkey.authn.support.rememberme.InMemoryRemeberMeService; -import org.maxkey.authn.support.rememberme.RedisRemeberMeService; -import org.maxkey.constants.ConstantsPersistence; import org.maxkey.constants.ConstantsProperties; import org.maxkey.crypto.keystore.KeyStoreLoader; import org.maxkey.crypto.password.LdapShaPasswordEncoder; @@ -43,14 +32,11 @@ import org.maxkey.crypto.password.MessageDigestPasswordEncoder; import org.maxkey.crypto.password.PasswordReciprocal; import org.maxkey.crypto.password.SM3PasswordEncoder; import org.maxkey.crypto.password.StandardPasswordEncoder; -import org.maxkey.persistence.db.PasswordPolicyValidator; -import org.maxkey.persistence.redis.RedisConnectionFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; @@ -66,8 +52,6 @@ import org.springframework.security.crypto.password.DelegatingPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder; import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder; -import org.maxkey.persistence.db.LoginService; -import org.maxkey.persistence.db.LoginHistoryService; @Configuration @@ -115,16 +99,6 @@ public class ApplicationAutoConfiguration implements InitializingBean { return new PasswordReciprocal(); } - @Bean(name = "savedRequestSuccessHandler") - public SavedRequestAwareAuthenticationSuccessHandler - savedRequestAwareAuthenticationSuccessHandler() { - return new SavedRequestAwareAuthenticationSuccessHandler(); - } - - @Bean(name = "authenticationProvider") - public AbstractAuthenticationProvider authenticationProvider() { - return new RealmAuthenticationProvider(); - } @Bean(name = "jdbcTemplate") public JdbcTemplate jdbcTemplate(DataSource dataSource) { @@ -136,20 +110,6 @@ public class ApplicationAutoConfiguration implements InitializingBean { return new DataSourceTransactionManager(dataSource); } - @Bean(name = "passwordPolicyValidator") - public PasswordPolicyValidator passwordPolicyValidator(JdbcTemplate jdbcTemplate,MessageSource messageSource) { - return new PasswordPolicyValidator(jdbcTemplate,messageSource); - } - - @Bean(name = "loginService") - public LoginService LoginService(JdbcTemplate jdbcTemplate) { - return new LoginService(jdbcTemplate); - } - @Bean(name = "loginHistoryService") - public LoginHistoryService loginHistoryService(JdbcTemplate jdbcTemplate) { - return new LoginHistoryService(jdbcTemplate); - } - /** * Authentication Password Encoder . @@ -182,48 +142,7 @@ public class ApplicationAutoConfiguration implements InitializingBean { return passwordEncoder; } - - /** - * remeberMeService . - * @return - */ - @Bean(name = "remeberMeService") - public AbstractRemeberMeService remeberMeService( - @Value("${config.server.persistence}") int persistence, - @Value("${config.login.remeberme.validity}") int validity, - JdbcTemplate jdbcTemplate, - RedisConnectionFactory redisConnFactory) { - AbstractRemeberMeService remeberMeService = null; - if (persistence == ConstantsPersistence.INMEMORY) { - remeberMeService = new InMemoryRemeberMeService(); - _logger.debug("InMemoryRemeberMeService"); - } else if (persistence == ConstantsPersistence.JDBC) { - //remeberMeService = new JdbcRemeberMeService(jdbcTemplate); - _logger.debug("JdbcRemeberMeService not support "); - } else if (persistence == ConstantsPersistence.REDIS) { - remeberMeService = new RedisRemeberMeService(redisConnFactory); - _logger.debug("RedisRemeberMeService"); - } - return remeberMeService; - } - - @Bean(name = "onlineTicketServices") - public OnlineTicketServices onlineTicketServices( - @Value("${config.server.persistence}") int persistence, - JdbcTemplate jdbcTemplate, - RedisConnectionFactory redisConnFactory) { - OnlineTicketServices onlineTicketServices = null; - if (persistence == ConstantsPersistence.INMEMORY) { - onlineTicketServices = new InMemoryOnlineTicketServices(); - _logger.debug("InMemoryOnlineTicketServices"); - } else if (persistence == ConstantsPersistence.JDBC) { - _logger.debug("OnlineTicketServices not support "); - } else if (persistence == ConstantsPersistence.REDIS) { - onlineTicketServices = new RedisOnlineTicketServices(redisConnFactory); - _logger.debug("RedisOnlineTicketServices"); - } - return onlineTicketServices; - } + /** * keyStoreLoader . diff --git a/maxkey-protocols/maxkey-protocol-authorize/build.gradle b/maxkey-protocols/maxkey-protocol-authorize/build.gradle index 60a26e71372f8a231233e4986f365f31ee5baa38..68e0bfdd2e2494a1eb0f5a28360cd6ca284148da 100644 --- a/maxkey-protocols/maxkey-protocol-authorize/build.gradle +++ b/maxkey-protocols/maxkey-protocol-authorize/build.gradle @@ -9,7 +9,6 @@ dependencies { compile project(":maxkey-common") compile project(":maxkey-core") compile project(":maxkey-persistence") - //compileOnly project(":maxkey-protocols:maxkey-protocol-oauth-2.0") - //compileOnly project(":maxkey-protocols:maxkey-protocol-saml-2.0") + compile project(":maxkey-authentications:maxkey-authentication-core") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-cas/build.gradle b/maxkey-protocols/maxkey-protocol-cas/build.gradle index cb4afd623ee33d6433d96ae26a364073fa7fc2c8..dd591dff7003531bc8ffada23ae11c844bbf4c40 100644 --- a/maxkey-protocols/maxkey-protocol-cas/build.gradle +++ b/maxkey-protocols/maxkey-protocol-cas/build.gradle @@ -17,5 +17,6 @@ dependencies { compile project(":maxkey-core") compile project(":maxkey-persistence") compile project(":maxkey-protocols:maxkey-protocol-authorize") + compile project(":maxkey-authentications:maxkey-authentication-core") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-desktop/build.gradle b/maxkey-protocols/maxkey-protocol-desktop/build.gradle index 0812aa96e6501df7a8ca70efc465747bf746a8ae..7709bb08a515ff12520b84d78b97925ca06a1f3d 100644 --- a/maxkey-protocols/maxkey-protocol-desktop/build.gradle +++ b/maxkey-protocols/maxkey-protocol-desktop/build.gradle @@ -10,5 +10,6 @@ dependencies { compile project(":maxkey-core") compile project(":maxkey-persistence") compile project(":maxkey-protocols:maxkey-protocol-authorize") + compile project(":maxkey-authentications:maxkey-authentication-core") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-extendapi/build.gradle b/maxkey-protocols/maxkey-protocol-extendapi/build.gradle index bfcead4388f2d734cf0b3e666ae60659e4d9efa4..39236d0702b323c314cd302e6763587a2d24715e 100644 --- a/maxkey-protocols/maxkey-protocol-extendapi/build.gradle +++ b/maxkey-protocols/maxkey-protocol-extendapi/build.gradle @@ -10,4 +10,5 @@ dependencies { compile project(":maxkey-core") compile project(":maxkey-persistence") compile project(":maxkey-protocols:maxkey-protocol-authorize") + compile project(":maxkey-authentications:maxkey-authentication-core") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-formbased/build.gradle b/maxkey-protocols/maxkey-protocol-formbased/build.gradle index 2d4bff3e41e045759a6507d55e33a23e146580cc..c4db01ef99c369073fc2ec028782388653c41927 100644 --- a/maxkey-protocols/maxkey-protocol-formbased/build.gradle +++ b/maxkey-protocols/maxkey-protocol-formbased/build.gradle @@ -10,5 +10,6 @@ dependencies { compile project(":maxkey-core") compile project(":maxkey-persistence") compile project(":maxkey-protocols:maxkey-protocol-authorize") + compile project(":maxkey-authentications:maxkey-authentication-core") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-jwt/build.gradle b/maxkey-protocols/maxkey-protocol-jwt/build.gradle index b2a2de5da42651d49b0dff49364e19b3809c31cf..c89f0d31a4a68d9c3a10a357e4a990897298a215 100644 --- a/maxkey-protocols/maxkey-protocol-jwt/build.gradle +++ b/maxkey-protocols/maxkey-protocol-jwt/build.gradle @@ -10,5 +10,6 @@ dependencies { compile project(":maxkey-core") compile project(":maxkey-persistence") compile project(":maxkey-protocols:maxkey-protocol-authorize") + compile project(":maxkey-authentications:maxkey-authentication-core") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/build.gradle b/maxkey-protocols/maxkey-protocol-oauth-2.0/build.gradle index b63103b04eaff2417189f6f2b29b97100b34aad4..de5eddf6b25e04957e801d48a6d03c16a43d2182 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/build.gradle +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/build.gradle @@ -8,5 +8,5 @@ dependencies { compile project(":maxkey-core") compile project(":maxkey-persistence") compile project(":maxkey-protocols:maxkey-protocol-authorize") - + compile project(":maxkey-authentications:maxkey-authentication-core") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-saml-2.0/build.gradle b/maxkey-protocols/maxkey-protocol-saml-2.0/build.gradle index 207bc009832dca318bfe8d6c9235c88c1ed0f717..3d99551f6edeb5def979245214d7cf5caabaa48d 100644 --- a/maxkey-protocols/maxkey-protocol-saml-2.0/build.gradle +++ b/maxkey-protocols/maxkey-protocol-saml-2.0/build.gradle @@ -7,4 +7,5 @@ dependencies { compile project(":maxkey-common") compile project(":maxkey-core") compile project(":maxkey-persistence") + compile project(":maxkey-authentications:maxkey-authentication-core") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-tokenbased/build.gradle b/maxkey-protocols/maxkey-protocol-tokenbased/build.gradle index 007b799f665c4078ceefded2bc7450ff5bc360d8..9a9a66be5e5dd680bae90a9cb146479078d13a3e 100644 --- a/maxkey-protocols/maxkey-protocol-tokenbased/build.gradle +++ b/maxkey-protocols/maxkey-protocol-tokenbased/build.gradle @@ -10,5 +10,6 @@ dependencies { compile project(":maxkey-core") compile project(":maxkey-persistence") compile project(":maxkey-protocols:maxkey-protocol-authorize") + compile project(":maxkey-authentications:maxkey-authentication-core") } \ No newline at end of file diff --git a/maxkey-web-manage/build.gradle b/maxkey-web-manage/build.gradle index 05d130b64a8b46c8651ce619aacb4618b38c5873..7a433428fea34f68d48803eda4b2c3a5cbd382db 100644 --- a/maxkey-web-manage/build.gradle +++ b/maxkey-web-manage/build.gradle @@ -62,6 +62,7 @@ jib { dependencies { compile project(":maxkey-common") compile project(":maxkey-core") + compile project(":maxkey-authentications:maxkey-authentication-core") compile project(":maxkey-authentications:maxkey-authentication-captcha") compile project(":maxkey-authentications:maxkey-authentication-otp") compile project(":maxkey-persistence") diff --git a/maxkey-web-manage/src/main/resources/META-INF/spring.factories b/maxkey-web-manage/src/main/resources/META-INF/spring.factories index 55fc464fec708084326e388d16b25985b062d8da..3704f89a0f43e222b482e29dd2f3b1751420f19e 100644 --- a/maxkey-web-manage/src/main/resources/META-INF/spring.factories +++ b/maxkey-web-manage/src/main/resources/META-INF/spring.factories @@ -5,5 +5,6 @@ org.maxkey.autoconfigure.KaptchaAutoConfiguration,\ org.maxkey.autoconfigure.MvcAutoConfiguration,\ org.maxkey.autoconfigure.JwtAuthnAutoConfiguration,\ org.maxkey.autoconfigure.RedisAutoConfiguration,\ +org.maxkey.autoconfigure.AuthenticationAutoConfiguration,\ org.maxkey.MaxKeyMgtConfig,\ org.maxkey.MaxKeyMgtMvcConfig diff --git a/maxkey-web-maxkey/src/main/resources/META-INF/spring.factories b/maxkey-web-maxkey/src/main/resources/META-INF/spring.factories index d2d4f76c25c32e9ed8abccd777870e753cfc7ae7..ce7f80d7c539ec65abe49cb6fb0f3d28afd8b8a8 100644 --- a/maxkey-web-maxkey/src/main/resources/META-INF/spring.factories +++ b/maxkey-web-maxkey/src/main/resources/META-INF/spring.factories @@ -4,6 +4,7 @@ org.maxkey.autoconfigure.ApplicationAutoConfiguration,\ org.maxkey.autoconfigure.MvcAutoConfiguration,\ org.maxkey.autoconfigure.KaptchaAutoConfiguration,\ org.maxkey.autoconfigure.RedisAutoConfiguration,\ +org.maxkey.autoconfigure.AuthenticationAutoConfiguration,\ org.maxkey.autoconfigure.CasAutoConfiguration,\ org.maxkey.autoconfigure.Oauth20AutoConfiguration,\ org.maxkey.autoconfigure.Saml20AutoConfiguration,\