diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/annotation/package-info.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/annotation/package-info.java deleted file mode 100644 index 26dfdac47..000000000 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/annotation/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright [2022] [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.authn.annotation; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/jwt/package-info.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/jwt/package-info.java deleted file mode 100644 index 9611d2edd..000000000 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/jwt/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright [2022] [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.authn.jwt; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/package-info.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/package-info.java deleted file mode 100644 index d0fb6a912..000000000 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright [2022] [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.authn.provider; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/SavedRequestAwareAuthenticationSuccessHandler.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/web/SavedRequestAwareAuthenticationSuccessHandler.java similarity index 99% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/SavedRequestAwareAuthenticationSuccessHandler.java rename to maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/web/SavedRequestAwareAuthenticationSuccessHandler.java index 008df5ef1..653589fd3 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/SavedRequestAwareAuthenticationSuccessHandler.java +++ b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/web/SavedRequestAwareAuthenticationSuccessHandler.java @@ -15,7 +15,7 @@ */ -package org.maxkey.authn; +package org.maxkey.authn.web; import java.io.IOException; import javax.servlet.ServletException; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/web/interceptor/package-info.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/web/interceptor/package-info.java deleted file mode 100644 index be5f31de0..000000000 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/web/interceptor/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright [2022] [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.authn.web.interceptor; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/SessionAutoConfiguration.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/SessionAutoConfiguration.java new file mode 100644 index 000000000..b7bc3d6c4 --- /dev/null +++ b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/SessionAutoConfiguration.java @@ -0,0 +1,69 @@ +/* + * Copyright [2022] [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 org.maxkey.authn.session.SessionManager; +import org.maxkey.authn.session.SessionManagerFactory; +import org.maxkey.authn.web.HttpSessionListenerAdapter; +import org.maxkey.authn.web.SavedRequestAwareAuthenticationSuccessHandler; +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.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jdbc.core.JdbcTemplate; + + +@Configuration +public class SessionAutoConfiguration implements InitializingBean { + private static final Logger _logger = + LoggerFactory.getLogger(SessionAutoConfiguration.class); + + + @Bean(name = "savedRequestSuccessHandler") + public SavedRequestAwareAuthenticationSuccessHandler + savedRequestAwareAuthenticationSuccessHandler() { + return new SavedRequestAwareAuthenticationSuccessHandler(); + } + + @Bean + public SessionManager sessionManager( + @Value("${maxkey.server.persistence}") int persistence, + JdbcTemplate jdbcTemplate, + RedisConnectionFactory redisConnFactory, + @Value("${maxkey.session.timeout:1800}") int timeout + ) { + _logger.debug("session timeout " + timeout); + SessionManager sessionManager = + new SessionManagerFactory( + persistence, jdbcTemplate, redisConnFactory,timeout); + return sessionManager; + } + + @Bean + public HttpSessionListenerAdapter httpSessionListenerAdapter() { + return new HttpSessionListenerAdapter(); + } + + @Override + public void afterPropertiesSet() throws Exception { + + } +} diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/TokenAutoConfiguration.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/TokenAutoConfiguration.java new file mode 100644 index 000000000..080cd1248 --- /dev/null +++ b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/TokenAutoConfiguration.java @@ -0,0 +1,77 @@ +/* + * Copyright [2022] [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 org.maxkey.authn.jwt.AuthRefreshTokenService; +import org.maxkey.authn.jwt.AuthTokenService; +import org.maxkey.authn.jwt.CongressService; +import org.maxkey.authn.jwt.InMemoryCongressService; +import org.maxkey.authn.jwt.RedisCongressService; +import org.maxkey.configuration.AuthJwkConfig; +import org.maxkey.constants.ConstsPersistence; +import org.maxkey.persistence.cache.MomentaryService; +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.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.nimbusds.jose.JOSEException; + + +@Configuration +public class TokenAutoConfiguration implements InitializingBean { + private static final Logger _logger = + LoggerFactory.getLogger(TokenAutoConfiguration.class); + + @Bean + public AuthTokenService authTokenService( + AuthJwkConfig authJwkConfig, + RedisConnectionFactory redisConnFactory, + MomentaryService momentaryService, + AuthRefreshTokenService refreshTokenService, + @Value("${maxkey.server.persistence}") int persistence) throws JOSEException { + CongressService congressService; + if (persistence == ConstsPersistence.REDIS) { + congressService = new RedisCongressService(redisConnFactory); + }else { + congressService = new InMemoryCongressService(); + } + + AuthTokenService authTokenService = + new AuthTokenService( + authJwkConfig, + congressService, + momentaryService, + refreshTokenService + ); + + return authTokenService; + } + + @Bean + public AuthRefreshTokenService refreshTokenService(AuthJwkConfig authJwkConfig) throws JOSEException { + return new AuthRefreshTokenService(authJwkConfig); + } + + @Override + public void afterPropertiesSet() throws Exception { + + } +} diff --git a/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/autoconfigure/OneTimePasswordAutoConfiguration.java b/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/autoconfigure/OneTimePasswordAutoConfiguration.java new file mode 100644 index 000000000..c15abd318 --- /dev/null +++ b/maxkey-authentications/maxkey-authentication-otp/src/main/java/org/maxkey/autoconfigure/OneTimePasswordAutoConfiguration.java @@ -0,0 +1,63 @@ +/* + * Copyright [2022] [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 org.maxkey.constants.ConstsPersistence; +import org.maxkey.password.onetimepwd.OtpAuthnService; +import org.maxkey.password.onetimepwd.token.RedisOtpTokenStore; +import org.maxkey.persistence.redis.RedisConnectionFactory; +import org.maxkey.persistence.service.EmailSendersService; +import org.maxkey.persistence.service.SmsProviderService; +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.annotation.Bean; +import org.springframework.context.annotation.Configuration; + + +@Configuration +public class OneTimePasswordAutoConfiguration implements InitializingBean { + private static final Logger _logger = + LoggerFactory.getLogger(OneTimePasswordAutoConfiguration.class); + + + @Bean(name = "otpAuthnService") + public OtpAuthnService otpAuthnService( + @Value("${maxkey.server.persistence}") int persistence, + SmsProviderService smsProviderService, + EmailSendersService emailSendersService, + RedisConnectionFactory redisConnFactory) { + OtpAuthnService otpAuthnService = + new OtpAuthnService(smsProviderService,emailSendersService); + + if (persistence == ConstsPersistence.REDIS) { + RedisOtpTokenStore redisOptTokenStore = new RedisOtpTokenStore(redisConnFactory); + otpAuthnService.setRedisOptTokenStore(redisOptTokenStore); + } + + _logger.debug("OneTimePasswordService {} inited." , + persistence == ConstsPersistence.REDIS ? "Redis" : "InMemory"); + return otpAuthnService; + } + + @Override + public void afterPropertiesSet() throws Exception { + + } +} diff --git a/maxkey-authentications/maxkey-authentication-provider/build.gradle b/maxkey-authentications/maxkey-authentication-provider/build.gradle new file mode 100644 index 000000000..5270778b6 --- /dev/null +++ b/maxkey-authentications/maxkey-authentication-provider/build.gradle @@ -0,0 +1,15 @@ + +description = "maxkey-authentication-provider" + + +dependencies { + //local jars + implementation fileTree(dir: '../maxkey-lib/', include: '*/*.jar') + + implementation project(":maxkey-common") + implementation project(":maxkey-core") + implementation project(":maxkey-persistence") + implementation project(":maxkey-authentications:maxkey-authentication-core") + implementation project(":maxkey-authentications:maxkey-authentication-otp") + +} \ No newline at end of file diff --git a/maxkey-authentications/maxkey-authentication-provider/src/main/java/META-INF/MANIFEST.MF b/maxkey-authentications/maxkey-authentication-provider/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 000000000..254272e1c --- /dev/null +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/AbstractAuthenticationProvider.java similarity index 98% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/AbstractAuthenticationProvider.java index 269fe63bf..082f2abeb 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/AbstractAuthenticationProvider.java @@ -15,10 +15,12 @@ */ -package org.maxkey.authn; +package org.maxkey.authn.provider; import java.util.ArrayList; +import org.maxkey.authn.LoginCredential; +import org.maxkey.authn.SignPrincipal; import org.maxkey.authn.jwt.AuthTokenService; import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.session.Session; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/AuthenticationProviderFactory.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/AuthenticationProviderFactory.java similarity index 97% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/AuthenticationProviderFactory.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/AuthenticationProviderFactory.java index 31449ea2c..e31b66296 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/AuthenticationProviderFactory.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/AuthenticationProviderFactory.java @@ -17,7 +17,6 @@ package org.maxkey.authn.provider; import java.util.concurrent.ConcurrentHashMap; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; import org.springframework.security.core.Authentication; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/MfaAuthenticationProvider.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/MfaAuthenticationProvider.java similarity index 98% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/MfaAuthenticationProvider.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/MfaAuthenticationProvider.java index 632e06f43..985a6e013 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/MfaAuthenticationProvider.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/MfaAuthenticationProvider.java @@ -15,11 +15,11 @@ */ -package org.maxkey.authn.provider; +package org.maxkey.authn.provider.impl; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; import org.maxkey.authn.jwt.AuthTokenService; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.session.SessionManager; import org.maxkey.configuration.ApplicationConfig; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/MobileAuthenticationProvider.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/MobileAuthenticationProvider.java similarity index 98% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/MobileAuthenticationProvider.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/MobileAuthenticationProvider.java index 17256777b..825694ae6 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/MobileAuthenticationProvider.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/MobileAuthenticationProvider.java @@ -15,10 +15,10 @@ */ -package org.maxkey.authn.provider; +package org.maxkey.authn.provider.impl; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.session.SessionManager; import org.maxkey.configuration.ApplicationConfig; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/NormalAuthenticationProvider.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/NormalAuthenticationProvider.java similarity index 98% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/NormalAuthenticationProvider.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/NormalAuthenticationProvider.java index 01df5620a..1e8f57e6b 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/NormalAuthenticationProvider.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/NormalAuthenticationProvider.java @@ -15,12 +15,13 @@ */ -package org.maxkey.authn.provider; +package org.maxkey.authn.provider.impl; import java.text.ParseException; -import org.maxkey.authn.AbstractAuthenticationProvider; + import org.maxkey.authn.LoginCredential; import org.maxkey.authn.jwt.AuthTokenService; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.session.SessionManager; import org.maxkey.configuration.ApplicationConfig; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/TrustedAuthenticationProvider.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/TrustedAuthenticationProvider.java similarity index 96% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/TrustedAuthenticationProvider.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/TrustedAuthenticationProvider.java index a2ca7fa04..18ac6c9f2 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/provider/TrustedAuthenticationProvider.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/provider/impl/TrustedAuthenticationProvider.java @@ -15,10 +15,10 @@ */ -package org.maxkey.authn.provider; +package org.maxkey.authn.provider.impl; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.session.SessionManager; import org.maxkey.configuration.ApplicationConfig; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/IAuthenticationServer.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/IAuthenticationServer.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/IAuthenticationServer.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/IAuthenticationServer.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/ldap/ActiveDirectoryServer.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/ldap/ActiveDirectoryServer.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/ldap/ActiveDirectoryServer.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/ldap/ActiveDirectoryServer.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/ldap/LdapAuthenticationRealm.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/ldap/LdapAuthenticationRealm.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/ldap/LdapAuthenticationRealm.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/ldap/LdapAuthenticationRealm.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/ldap/LdapAuthenticationRealmService.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/ldap/LdapAuthenticationRealmService.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/ldap/LdapAuthenticationRealmService.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/ldap/LdapAuthenticationRealmService.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/ldap/StandardLdapServer.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/ldap/StandardLdapServer.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/ldap/StandardLdapServer.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/realm/ldap/StandardLdapServer.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/basic/BasicEntryPoint.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/basic/BasicEntryPoint.java similarity index 98% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/basic/BasicEntryPoint.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/basic/BasicEntryPoint.java index 06e14875c..566217210 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/basic/BasicEntryPoint.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/basic/BasicEntryPoint.java @@ -20,8 +20,8 @@ package org.maxkey.authn.support.basic; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.constants.ConstsLoginType; import org.maxkey.util.AuthorizationHeaderCredential; import org.maxkey.util.AuthorizationHeaderUtils; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/certs/HttpCertsEntryPoint.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/certs/HttpCertsEntryPoint.java similarity index 98% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/certs/HttpCertsEntryPoint.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/certs/HttpCertsEntryPoint.java index 81424d85d..986c24680 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/certs/HttpCertsEntryPoint.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/certs/HttpCertsEntryPoint.java @@ -22,7 +22,7 @@ import java.security.cert.X509Certificate; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.maxkey.authn.AbstractAuthenticationProvider; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.support.httpheader.HttpHeaderEntryPoint; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java similarity index 98% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java index 5d54c8773..6321536d3 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java @@ -20,8 +20,8 @@ package org.maxkey.authn.support.httpheader; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.constants.ConstsLoginType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/jwt/HttpJwtEntryPoint.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/jwt/HttpJwtEntryPoint.java similarity index 98% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/jwt/HttpJwtEntryPoint.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/jwt/HttpJwtEntryPoint.java index 7d30cff6e..8341f204e 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/jwt/HttpJwtEntryPoint.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/jwt/HttpJwtEntryPoint.java @@ -16,10 +16,10 @@ package org.maxkey.authn.support.jwt; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; import org.maxkey.authn.jwt.AuthJwt; import org.maxkey.authn.jwt.AuthTokenService; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.configuration.ApplicationConfig; import org.maxkey.constants.ConstsLoginType; import org.maxkey.entity.Message; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/jwt/JwtLoginService.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/jwt/JwtLoginService.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/jwt/JwtLoginService.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/jwt/JwtLoginService.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/HttpKerberosEntryPoint.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/HttpKerberosEntryPoint.java similarity index 98% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/HttpKerberosEntryPoint.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/HttpKerberosEntryPoint.java index 15f2655e5..6f0fd2928 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/HttpKerberosEntryPoint.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/HttpKerberosEntryPoint.java @@ -20,8 +20,8 @@ package org.maxkey.authn.support.kerberos; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.joda.time.DateTime; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.web.AuthorizationUtils; import org.maxkey.configuration.ApplicationConfig; import org.maxkey.constants.ConstsLoginType; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/KerberosProxy.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/KerberosProxy.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/KerberosProxy.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/KerberosProxy.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/KerberosService.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/KerberosService.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/KerberosService.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/KerberosService.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/KerberosToken.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/KerberosToken.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/KerberosToken.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/KerberosToken.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/RemoteKerberosService.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/RemoteKerberosService.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/kerberos/RemoteKerberosService.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/kerberos/RemoteKerberosService.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeManager.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeManager.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeManager.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeManager.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/InMemoryRemeberMeManager.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/rememberme/InMemoryRemeberMeManager.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/InMemoryRemeberMeManager.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/rememberme/InMemoryRemeberMeManager.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/JdbcRemeberMeManager.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/rememberme/JdbcRemeberMeManager.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/JdbcRemeberMeManager.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/rememberme/JdbcRemeberMeManager.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/RemeberMe.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/rememberme/RemeberMe.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/RemeberMe.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/rememberme/RemeberMe.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/RemeberMeManagerFactory.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/rememberme/RemeberMeManagerFactory.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/RemeberMeManagerFactory.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/rememberme/RemeberMeManagerFactory.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/HttpWsFederationEntryPoint.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/HttpWsFederationEntryPoint.java similarity index 98% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/HttpWsFederationEntryPoint.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/HttpWsFederationEntryPoint.java index 543a2e580..f64c91683 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/HttpWsFederationEntryPoint.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/HttpWsFederationEntryPoint.java @@ -19,8 +19,9 @@ package org.maxkey.authn.support.wsfederation; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.maxkey.authn.AbstractAuthenticationProvider; + import org.maxkey.authn.LoginCredential; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.web.AuthorizationUtils; import org.maxkey.configuration.ApplicationConfig; import org.maxkey.constants.ConstsLoginType; diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFedAttributeMutatorImpl.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFedAttributeMutatorImpl.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFedAttributeMutatorImpl.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFedAttributeMutatorImpl.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationAttributeMutator.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationAttributeMutator.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationAttributeMutator.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationAttributeMutator.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationConfiguration.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationConfiguration.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationConfiguration.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationConfiguration.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationConstants.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationConstants.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationConstants.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationConstants.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationCredential.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationCredential.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationCredential.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationCredential.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationService.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationService.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationService.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationService.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationServiceImpl.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationServiceImpl.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationServiceImpl.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationServiceImpl.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationUtils.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationUtils.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationUtils.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationUtils.java diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/AuthenticationAutoConfiguration.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/autoconfigure/AuthnProviderAutoConfiguration.java similarity index 59% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/AuthenticationAutoConfiguration.java rename to maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/autoconfigure/AuthnProviderAutoConfiguration.java index dc7cbd6f2..bd55b521f 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/AuthenticationAutoConfiguration.java +++ b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/autoconfigure/AuthnProviderAutoConfiguration.java @@ -17,30 +17,20 @@ package org.maxkey.autoconfigure; -import org.maxkey.authn.AbstractAuthenticationProvider; -import org.maxkey.authn.SavedRequestAwareAuthenticationSuccessHandler; -import org.maxkey.authn.jwt.AuthRefreshTokenService; import org.maxkey.authn.jwt.AuthTokenService; -import org.maxkey.authn.jwt.CongressService; -import org.maxkey.authn.jwt.InMemoryCongressService; -import org.maxkey.authn.jwt.RedisCongressService; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.provider.AuthenticationProviderFactory; -import org.maxkey.authn.provider.MobileAuthenticationProvider; -import org.maxkey.authn.provider.NormalAuthenticationProvider; -import org.maxkey.authn.provider.TrustedAuthenticationProvider; +import org.maxkey.authn.provider.impl.MobileAuthenticationProvider; +import org.maxkey.authn.provider.impl.NormalAuthenticationProvider; +import org.maxkey.authn.provider.impl.TrustedAuthenticationProvider; import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.session.SessionManager; -import org.maxkey.authn.session.SessionManagerFactory; import org.maxkey.authn.support.rememberme.AbstractRemeberMeManager; import org.maxkey.authn.support.rememberme.JdbcRemeberMeManager; -import org.maxkey.authn.web.HttpSessionListenerAdapter; import org.maxkey.configuration.ApplicationConfig; -import org.maxkey.configuration.AuthJwkConfig; import org.maxkey.constants.ConstsPersistence; -import org.maxkey.password.onetimepwd.AbstractOtpAuthn; import org.maxkey.password.onetimepwd.OtpAuthnService; import org.maxkey.password.onetimepwd.token.RedisOtpTokenStore; -import org.maxkey.persistence.cache.MomentaryService; import org.maxkey.persistence.redis.RedisConnectionFactory; import org.maxkey.persistence.repository.LoginHistoryRepository; import org.maxkey.persistence.repository.LoginRepository; @@ -56,20 +46,11 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.core.JdbcTemplate; -import com.nimbusds.jose.JOSEException; - @Configuration -public class AuthenticationAutoConfiguration implements InitializingBean { +public class AuthnProviderAutoConfiguration implements InitializingBean { private static final Logger _logger = - LoggerFactory.getLogger(AuthenticationAutoConfiguration.class); - - - @Bean(name = "savedRequestSuccessHandler") - public SavedRequestAwareAuthenticationSuccessHandler - savedRequestAwareAuthenticationSuccessHandler() { - return new SavedRequestAwareAuthenticationSuccessHandler(); - } + LoggerFactory.getLogger(AuthnProviderAutoConfiguration.class); @Bean public AbstractAuthenticationProvider authenticationProvider( @@ -131,55 +112,6 @@ public class AuthenticationAutoConfiguration implements InitializingBean { ); } - @Bean - public AuthTokenService authTokenService( - AuthJwkConfig authJwkConfig, - RedisConnectionFactory redisConnFactory, - MomentaryService momentaryService, - AuthRefreshTokenService refreshTokenService, - @Value("${maxkey.server.persistence}") int persistence) throws JOSEException { - CongressService congressService; - if (persistence == ConstsPersistence.REDIS) { - congressService = new RedisCongressService(redisConnFactory); - }else { - congressService = new InMemoryCongressService(); - } - - AuthTokenService authTokenService = - new AuthTokenService( - authJwkConfig, - congressService, - momentaryService, - refreshTokenService - ); - - return authTokenService; - } - - @Bean - public AuthRefreshTokenService refreshTokenService(AuthJwkConfig authJwkConfig) throws JOSEException { - return new AuthRefreshTokenService(authJwkConfig); - } - - @Bean(name = "otpAuthnService") - public OtpAuthnService otpAuthnService( - @Value("${maxkey.server.persistence}") int persistence, - SmsProviderService smsProviderService, - EmailSendersService emailSendersService, - RedisConnectionFactory redisConnFactory) { - OtpAuthnService otpAuthnService = - new OtpAuthnService(smsProviderService,emailSendersService); - - if (persistence == ConstsPersistence.REDIS) { - RedisOtpTokenStore redisOptTokenStore = new RedisOtpTokenStore(redisConnFactory); - otpAuthnService.setRedisOptTokenStore(redisOptTokenStore); - } - - _logger.debug("OneTimePasswordService {} inited." , - persistence == ConstsPersistence.REDIS ? "Redis" : "InMemory"); - return otpAuthnService; - } - @Bean public PasswordPolicyValidator passwordPolicyValidator(JdbcTemplate jdbcTemplate,MessageSource messageSource) { return new PasswordPolicyValidator(jdbcTemplate,messageSource); @@ -195,20 +127,6 @@ public class AuthenticationAutoConfiguration implements InitializingBean { return new LoginHistoryRepository(jdbcTemplate); } - @Bean - public SessionManager sessionManager( - @Value("${maxkey.server.persistence}") int persistence, - JdbcTemplate jdbcTemplate, - RedisConnectionFactory redisConnFactory, - @Value("${maxkey.session.timeout:1800}") int timeout - ) { - _logger.debug("session timeout " + timeout); - SessionManager sessionManager = - new SessionManagerFactory( - persistence, jdbcTemplate, redisConnFactory,timeout); - return sessionManager; - } - /** * remeberMeService . * @return @@ -225,11 +143,6 @@ public class AuthenticationAutoConfiguration implements InitializingBean { jdbcTemplate,applicationConfig,authTokenService,validity); } - @Bean - public HttpSessionListenerAdapter httpSessionListenerAdapter() { - return new HttpSessionListenerAdapter(); - } - @Override public void afterPropertiesSet() throws Exception { diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java b/maxkey-authentications/maxkey-authentication-provider/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java similarity index 100% rename from maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/JwtAuthnAutoConfiguration.java rename to maxkey-authentications/maxkey-authentication-provider/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 150a00b0e..ead068efc 100644 --- a/maxkey-authentications/maxkey-authentication-social/build.gradle +++ b/maxkey-authentications/maxkey-authentication-social/build.gradle @@ -10,5 +10,6 @@ dependencies { implementation project(":maxkey-core") implementation project(":maxkey-persistence") implementation project(":maxkey-authentications:maxkey-authentication-core") + implementation project(":maxkey-authentications:maxkey-authentication-provider") } \ No newline at end of file diff --git a/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/AbstractSocialSignOnEndpoint.java b/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/AbstractSocialSignOnEndpoint.java index 2dbfe42e2..3a414569f 100644 --- a/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/AbstractSocialSignOnEndpoint.java +++ b/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/AbstractSocialSignOnEndpoint.java @@ -20,8 +20,8 @@ */ package org.maxkey.authn.support.socialsignon; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.jwt.AuthTokenService; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService; import org.maxkey.authn.support.socialsignon.service.SocialsAssociateService; import org.maxkey.configuration.ApplicationConfig; diff --git a/maxkey-core/src/main/java/org/maxkey/persistence/cache/package-info.java b/maxkey-core/src/main/java/org/maxkey/persistence/cache/package-info.java index 83c7c03de..fa98cc303 100644 --- a/maxkey-core/src/main/java/org/maxkey/persistence/cache/package-info.java +++ b/maxkey-core/src/main/java/org/maxkey/persistence/cache/package-info.java @@ -1 +1,25 @@ -package org.maxkey.persistence.cache; \ No newline at end of file +/* + * 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. + */ + + +/** + * + */ +/** + * @author Administrator + * + */ +package org.maxkey.persistence.cache; diff --git a/maxkey-protocols/maxkey-protocol-cas/build.gradle b/maxkey-protocols/maxkey-protocol-cas/build.gradle index 794ea63e8..4dac6a58c 100644 --- a/maxkey-protocols/maxkey-protocol-cas/build.gradle +++ b/maxkey-protocols/maxkey-protocol-cas/build.gradle @@ -18,5 +18,6 @@ dependencies { implementation project(":maxkey-persistence") implementation project(":maxkey-protocols:maxkey-protocol-authorize") implementation project(":maxkey-authentications:maxkey-authentication-core") + implementation project(":maxkey-authentications:maxkey-authentication-provider") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/CasRestV1Endpoint.java b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/CasRestV1Endpoint.java index d91068291..7a68fe8d8 100644 --- a/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/CasRestV1Endpoint.java +++ b/maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/CasRestV1Endpoint.java @@ -23,8 +23,8 @@ package org.maxkey.authz.cas.endpoint; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.web.AuthorizationUtils; import org.maxkey.authz.cas.endpoint.response.ServiceResponseBuilder; import org.maxkey.authz.cas.endpoint.ticket.CasConstants; diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/build.gradle b/maxkey-protocols/maxkey-protocol-oauth-2.0/build.gradle index 0599814d2..3c851c37a 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/build.gradle +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/build.gradle @@ -9,4 +9,5 @@ dependencies { implementation project(":maxkey-persistence") implementation project(":maxkey-protocols:maxkey-protocol-authorize") implementation project(":maxkey-authentications:maxkey-authentication-core") + implementation project(":maxkey-authentications:maxkey-authentication-provider") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/OAuth2UserDetailsService.java b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/OAuth2UserDetailsService.java index 4bef822c7..841f78541 100644 --- a/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/OAuth2UserDetailsService.java +++ b/maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/OAuth2UserDetailsService.java @@ -14,8 +14,8 @@ package org.maxkey.authz.oauth2.provider; import java.util.ArrayList; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.SignPrincipal; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.session.Session; import org.maxkey.entity.UserInfo; import org.maxkey.persistence.repository.LoginRepository; diff --git a/maxkey-protocols/maxkey-protocol-saml-2.0/build.gradle b/maxkey-protocols/maxkey-protocol-saml-2.0/build.gradle index 45647c527..a38d3dd08 100644 --- a/maxkey-protocols/maxkey-protocol-saml-2.0/build.gradle +++ b/maxkey-protocols/maxkey-protocol-saml-2.0/build.gradle @@ -8,4 +8,5 @@ dependencies { implementation project(":maxkey-core") implementation project(":maxkey-persistence") implementation project(":maxkey-authentications:maxkey-authentication-core") + implementation project(":maxkey-authentications:maxkey-authentication-provider") } \ No newline at end of file diff --git a/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java b/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java index 96d160c81..e7876c740 100644 --- a/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java +++ b/maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java @@ -30,10 +30,10 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.Validate; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; import org.maxkey.authn.jwt.AuthJwt; import org.maxkey.authn.jwt.AuthTokenService; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authz.saml.common.EndpointGenerator; import org.maxkey.authz.saml.common.TrustResolver; import org.maxkey.authz.saml.service.IDService; diff --git a/maxkey-webs/maxkey-web-maxkey/build.gradle b/maxkey-webs/maxkey-web-maxkey/build.gradle index d4321076a..54c9b478e 100644 --- a/maxkey-webs/maxkey-web-maxkey/build.gradle +++ b/maxkey-webs/maxkey-web-maxkey/build.gradle @@ -12,6 +12,7 @@ dependencies { implementation project(":maxkey-authentications:maxkey-authentication-social") implementation project(":maxkey-authentications:maxkey-authentication-captcha") implementation project(":maxkey-authentications:maxkey-authentication-otp") + implementation project(":maxkey-authentications:maxkey-authentication-provider") implementation project(":maxkey-protocols:maxkey-protocol-authorize") implementation project(":maxkey-protocols:maxkey-protocol-cas") diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyMvcConfig.java b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyMvcConfig.java index f289c8900..cd1df0a3d 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyMvcConfig.java +++ b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyMvcConfig.java @@ -19,7 +19,7 @@ package org.maxkey; import java.util.List; -import org.maxkey.authn.AbstractAuthenticationProvider; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.support.basic.BasicEntryPoint; import org.maxkey.authn.support.httpheader.HttpHeaderEntryPoint; import org.maxkey.authn.support.kerberos.HttpKerberosEntryPoint; diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java index 9e307cb54..d5f740849 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java +++ b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java @@ -25,10 +25,10 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; import org.maxkey.authn.jwt.AuthJwt; import org.maxkey.authn.jwt.AuthTokenService; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.support.kerberos.KerberosService; import org.maxkey.authn.support.rememberme.AbstractRemeberMeManager; import org.maxkey.authn.support.rememberme.RemeberMe; diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/META-INF/spring.factories b/maxkey-webs/maxkey-web-maxkey/src/main/resources/META-INF/spring.factories index ce7f80d7c..cf94dcae7 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/META-INF/spring.factories +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/META-INF/spring.factories @@ -4,7 +4,10 @@ org.maxkey.autoconfigure.ApplicationAutoConfiguration,\ org.maxkey.autoconfigure.MvcAutoConfiguration,\ org.maxkey.autoconfigure.KaptchaAutoConfiguration,\ org.maxkey.autoconfigure.RedisAutoConfiguration,\ -org.maxkey.autoconfigure.AuthenticationAutoConfiguration,\ +org.maxkey.autoconfigure.AuthnProviderAutoConfiguration,\ +org.maxkey.autoconfigure.OneTimePasswordAutoConfiguration,\ +org.maxkey.autoconfigure.SessionAutoConfiguration,\ +org.maxkey.autoconfigure.TokenAutoConfiguration,\ org.maxkey.autoconfigure.CasAutoConfiguration,\ org.maxkey.autoconfigure.Oauth20AutoConfiguration,\ org.maxkey.autoconfigure.Saml20AutoConfiguration,\ diff --git a/maxkey-webs/maxkey-web-mgt/build.gradle b/maxkey-webs/maxkey-web-mgt/build.gradle index bb0e29cc0..3f9bf2316 100644 --- a/maxkey-webs/maxkey-web-mgt/build.gradle +++ b/maxkey-webs/maxkey-web-mgt/build.gradle @@ -11,6 +11,7 @@ dependencies { implementation project(":maxkey-authentications:maxkey-authentication-core") implementation project(":maxkey-authentications:maxkey-authentication-captcha") implementation project(":maxkey-authentications:maxkey-authentication-otp") + implementation project(":maxkey-authentications:maxkey-authentication-provider") implementation project(":maxkey-protocols:maxkey-protocol-oauth-2.0") implementation project(":maxkey-protocols:maxkey-protocol-saml-2.0") diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/MaxKeyMgtMvcConfig.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/MaxKeyMgtMvcConfig.java index 4980ec20c..4cb72da38 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/MaxKeyMgtMvcConfig.java +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/MaxKeyMgtMvcConfig.java @@ -19,7 +19,7 @@ package org.maxkey; import java.util.List; -import org.maxkey.authn.AbstractAuthenticationProvider; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.authn.web.CurrentUserMethodArgumentResolver; import org.maxkey.authn.web.interceptor.PermissionInterceptor; import org.maxkey.configuration.ApplicationConfig; diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java index b3e0e4a70..e52e8d232 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java @@ -19,10 +19,10 @@ package org.maxkey.web.contorller; import java.util.HashMap; -import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.LoginCredential; import org.maxkey.authn.jwt.AuthJwt; import org.maxkey.authn.jwt.AuthTokenService; +import org.maxkey.authn.provider.AbstractAuthenticationProvider; import org.maxkey.configuration.ApplicationConfig; import org.maxkey.entity.Institutions; import org.maxkey.entity.Message; diff --git a/maxkey-webs/maxkey-web-mgt/src/main/resources/META-INF/spring.factories b/maxkey-webs/maxkey-web-mgt/src/main/resources/META-INF/spring.factories index dc8fdd99f..f94f5b759 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/resources/META-INF/spring.factories +++ b/maxkey-webs/maxkey-web-mgt/src/main/resources/META-INF/spring.factories @@ -5,7 +5,10 @@ org.maxkey.autoconfigure.KaptchaAutoConfiguration,\ org.maxkey.autoconfigure.MvcAutoConfiguration,\ org.maxkey.autoconfigure.JwtAuthnAutoConfiguration,\ org.maxkey.autoconfigure.RedisAutoConfiguration,\ -org.maxkey.autoconfigure.AuthenticationAutoConfiguration,\ +org.maxkey.autoconfigure.AuthnProviderAutoConfiguration,\ +org.maxkey.autoconfigure.OneTimePasswordAutoConfiguration,\ +org.maxkey.autoconfigure.SessionAutoConfiguration,\ +org.maxkey.autoconfigure.TokenAutoConfiguration,\ org.maxkey.synchronizer.autoconfigure.SynchronizerAutoConfiguration,\ org.maxkey.autoconfigure.SwaggerConfig,\ org.maxkey.Oauth20ClientAutoConfiguration,\ diff --git a/settings.gradle b/settings.gradle index a8b933f43..cd93eb46b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -30,6 +30,7 @@ include ( 'maxkey-authentications:maxkey-authentication-captcha', 'maxkey-authentications:maxkey-authentication-social', 'maxkey-authentications:maxkey-authentication-otp', + 'maxkey-authentications:maxkey-authentication-provider', //identity 'maxkey-identitys:maxkey-identity-scim', 'maxkey-identitys:maxkey-identity-rest',