diff options
author | Thomas <> | 2022-01-08 19:12:53 +0100 |
---|---|---|
committer | Thomas <> | 2022-01-08 19:12:53 +0100 |
commit | e7ee4d20559ee82104f2c7c1584aa34b7c8dbebe (patch) | |
tree | f66e396c7d9a34626795f94ed0a081885f57e1a9 | |
parent | 999234a7e906b80c36f63127d753a8b37ac8e35e (diff) | |
download | EAAF-Components-e7ee4d20559ee82104f2c7c1584aa34b7c8dbebe.tar.gz EAAF-Components-e7ee4d20559ee82104f2c7c1584aa34b7c8dbebe.tar.bz2 EAAF-Components-e7ee4d20559ee82104f2c7c1584aa34b7c8dbebe.zip |
[fix] solve circular dependencies between 'AuthenticationManager', 'ModuleRegistration', and 'AuthModule' implementations
4 files changed, 30 insertions, 36 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java index 2449340d..89977308 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.List; +import javax.annotation.PostConstruct; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -34,6 +35,7 @@ import org.apache.commons.text.StringEscapeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.IRequestStorage; @@ -66,6 +68,9 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa public static final int SLOTIMEOUT = 30 * 1000; // 30 sec + @Autowired + private ApplicationContext ctx; + @Autowired(required = true) protected IConfiguration authConfig; @Autowired(required = true) @@ -76,31 +81,35 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa protected IRevisionLogger revisionsLogger; @Autowired(required = false) protected ISsoManager ssoManager; - @Autowired + ModuleRegistration moduleRegistration; - /* - * (non-Javadoc) + @PostConstruct + private void initializer() { + moduleRegistration = ctx.getBean(ModuleRegistration.class); + + } + + /** + * Add a request parameter to whitelist. All parameters that are part of the + * white list are added into {@link ExecutionContext} * - * @see at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager# - * addParameterNameToWhiteList(java.lang .String) + * @param httpReqParam http parameter name, but never null */ - @Override - public final void addParameterNameToWhiteList(final String httpReqParam) { + public static final void addParameterNameToWhiteList(final String httpReqParam) { if (StringUtils.isNotEmpty(httpReqParam)) { reqParameterWhiteListeForModules.add(httpReqParam); } } - /* - * (non-Javadoc) + /** + * Add a request header to whitelist. All parameters that are part of the white + * list are added into {@link ExecutionContext} * - * @see at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager# - * addHeaderNameToWhiteList(java.lang. String) + * @param httpReqParam http header name, but never null */ - @Override - public final void addHeaderNameToWhiteList(final String httpReqParam) { + public static final void addHeaderNameToWhiteList(final String httpReqParam) { if (StringUtils.isNotEmpty(httpReqParam)) { reqHeaderWhiteListeForModules.add(httpReqParam.toLowerCase()); } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java index c4f1b505..cb14e1df 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java @@ -101,6 +101,10 @@ public class ModuleRegistration { private void initSpringModules() { log.debug("Discovering Spring modules."); final Map<String, AuthModule> modules = ctx.getBeansOfType(AuthModule.class); + + ctx.getBean("createBindingAuthModul"); + + for (final AuthModule module : modules.values()) { registerModuleProcessDefinitions(module); priorizedModules.add(module); diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/IAuthenticationManager.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/IAuthenticationManager.java index 3dba4e78..c72c5b6f 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/IAuthenticationManager.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/IAuthenticationManager.java @@ -23,7 +23,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; import at.gv.egiz.eaaf.core.api.idp.slo.ISloInformationContainer; import at.gv.egiz.eaaf.core.exceptions.EaafException; @@ -35,22 +34,6 @@ public interface IAuthenticationManager { int EVENT_AUTHENTICATION_PROCESS_ERROR = 4002; /** - * Add a request parameter to whitelist. All parameters that are part of the - * white list are added into {@link ExecutionContext} - * - * @param httpReqParam http parameter name, but never null - */ - void addParameterNameToWhiteList(String httpReqParam); - - /** - * Add a request header to whitelist. All parameters that are part of the white - * list are added into {@link ExecutionContext} - * - * @param httpReqParam http header name, but never null - */ - void addHeaderNameToWhiteList(String httpReqParam); - - /** * Starts an authentication process for a specific pending request. * * @param httpReq http servlet request diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/AbstractSL20AuthenticationModulImpl.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/AbstractSL20AuthenticationModulImpl.java index e9932ae8..d561a0bc 100644 --- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/AbstractSL20AuthenticationModulImpl.java +++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/AbstractSL20AuthenticationModulImpl.java @@ -29,11 +29,9 @@ public abstract class AbstractSL20AuthenticationModulImpl implements AuthModule private int priority = 3; public static final List<String> VDA_TYPE_IDS = Arrays.asList("1", "2", "3", "4"); - + @Autowired(required = true) protected IConfiguration authConfig; - @Autowired(required = true) - private AbstractAuthenticationManager authManager; @Override public int getPriority() { @@ -51,9 +49,9 @@ public abstract class AbstractSL20AuthenticationModulImpl implements AuthModule @PostConstruct protected void initalSL20Authentication() { - // parameter to whiteList - authManager.addHeaderNameToWhiteList(SL20Constants.HTTP_HEADER_SL20_CLIENT_TYPE); - authManager.addHeaderNameToWhiteList(SL20Constants.HTTP_HEADER_SL20_VDA_TYPE); + // parameter to whiteList + AbstractAuthenticationManager.addHeaderNameToWhiteList(SL20Constants.HTTP_HEADER_SL20_CLIENT_TYPE); + AbstractAuthenticationManager.addHeaderNameToWhiteList(SL20Constants.HTTP_HEADER_SL20_VDA_TYPE); } |