[java-identity-provider] branch main updated: Allow for differently named IdP servlet if necessary.
Scott Cantor
cantor.2 at osu.edu
Thu Sep 29 18:53:31 UTC 2022
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=3a20432c0450ec5439018828ad8a2f1eac61650c
The following commit(s) were added to refs/heads/main by this push:
new 3a20432c0 Allow for differently named IdP servlet if necessary.
3a20432c0 is described below
commit 3a20432c0450ec5439018828ad8a2f1eac61650c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Sep 29 14:53:28 2022 -0400
Allow for differently named IdP servlet if necessary.
---
...egisterFilterChainServletContextInitializer.java | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/idp-conf-impl/src/main/java/net/shibboleth/idp/conf/impl/RegisterFilterChainServletContextInitializer.java b/idp-conf-impl/src/main/java/net/shibboleth/idp/conf/impl/RegisterFilterChainServletContextInitializer.java
index 331048f68..f26b77b29 100644
--- a/idp-conf-impl/src/main/java/net/shibboleth/idp/conf/impl/RegisterFilterChainServletContextInitializer.java
+++ b/idp-conf-impl/src/main/java/net/shibboleth/idp/conf/impl/RegisterFilterChainServletContextInitializer.java
@@ -30,6 +30,7 @@ import jakarta.servlet.ServletContainerInitializer;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.StringSupport;
/**
* A {@link ServletContainerInitializer} implementation that registers a filter chain embedded in
@@ -44,9 +45,16 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
public class RegisterFilterChainServletContextInitializer implements ServletContainerInitializer {
/** System property name for the activation of this class. */
- public static final String SYSTEM_PROPERTY_ACTIVATION =
+ @Nonnull @NotEmpty public static final String SYSTEM_PROPERTY_ACTIVATION =
RegisterFilterChainServletContextInitializer.class.getCanonicalName();
+ /** System property name for the activation of this class. */
+ @Nonnull @NotEmpty public static final String SYSTEM_PROPERTY_SERVLET =
+ RegisterFilterChainServletContextInitializer.class.getCanonicalName() + ".servlet";
+
+ /** Name of servlet that MUST be registered for us to run. */
+ @Nonnull @NotEmpty public static final String DEFAULT_SERVLET_TO_CHECK = "idp";
+
/** The filter name for the embedded filter chain. */
@Nonnull @NotEmpty public static final String FILTER_NAME = "ShibbolethFilterChain";
@@ -60,18 +68,17 @@ public class RegisterFilterChainServletContextInitializer implements ServletCont
@Override
public void onStartup(final Set<Class<?>> c, final ServletContext ctx) throws ServletException {
- if (ctx.getServletRegistration("idp") == null) {
- log.debug("Ignoring invocation outside IdP context");
- return;
- }
-
final String flag = System.getProperty(SYSTEM_PROPERTY_ACTIVATION);
log.debug("The value of the flag {}: {}", SYSTEM_PROPERTY_ACTIVATION, flag);
if ("disabled".equalsIgnoreCase(flag)) {
log.info("Filter registration is disabled according to the system properties");
return;
+ } else if (ctx.getServletRegistration(StringSupport.trimOrNull(
+ System.getProperty(SYSTEM_PROPERTY_SERVLET, DEFAULT_SERVLET_TO_CHECK))) == null) {
+ log.debug("Ignoring invocation outside IdP context");
+ return;
}
-
+
log.debug("Attempting to register filter '{}'", FILTER_NAME);
final FilterRegistration.Dynamic headerFilter = ctx.addFilter(FILTER_NAME, DelegatingFilterProxy.class);
headerFilter.addMappingForUrlPatterns(null, false, "/*");
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list