From e7ee4d20559ee82104f2c7c1584aa34b7c8dbebe Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Sat, 8 Jan 2022 19:12:53 +0100 Subject: [fix] solve circular dependencies between 'AuthenticationManager', 'ModuleRegistration', and 'AuthModule' implementations --- .../idp/auth/AbstractAuthenticationManager.java | 35 ++++++++++++++-------- .../impl/idp/auth/modules/ModuleRegistration.java | 4 +++ 2 files changed, 26 insertions(+), 13 deletions(-) (limited to 'eaaf_core/src') 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 modules = ctx.getBeansOfType(AuthModule.class); + + ctx.getBean("createBindingAuthModul"); + + for (final AuthModule module : modules.values()) { registerModuleProcessDefinitions(module); priorizedModules.add(module); -- cgit v1.2.3