[java-identity-provider] branch master updated: Add a flag to disable ByReference filter processing.

Scott Cantor cantor.2 at osu.edu
Wed Oct 23 10:12:54 EDT 2019


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=71e63f415009a915a940cfa530dca1bcb46b97c3

The following commit(s) were added to refs/heads/master by this push:
       new  71e63f4   Add a flag to disable ByReference filter processing.
71e63f4 is described below

commit 71e63f415009a915a940cfa530dca1bcb46b97c3
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Oct 23 10:12:50 2019 -0400

    Add a flag to disable ByReference filter processing.
---
 .../src/main/resources/conf/services.properties    |  2 ++
 .../system/conf/metadata-providers-system.xml      |  3 ++-
 .../impl/ByReferenceFilterBeanPostProcessor.java   | 24 ++++++++++++++++++++--
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/idp-conf/src/main/resources/conf/services.properties b/idp-conf/src/main/resources/conf/services.properties
index b5d0572..3331c84 100644
--- a/idp-conf/src/main/resources/conf/services.properties
+++ b/idp-conf/src/main/resources/conf/services.properties
@@ -22,6 +22,8 @@ idp.service.relyingparty.ignoreUnmappedEntityAttributes=true
 #idp.service.metadata.resources = shibboleth.MetadataResolverResources
 #idp.service.metadata.failFast = false
 #idp.service.metadata.checkInterval = PT0S
+# Set to false if not using ByReference MetadataFilters for a small perf gain
+#idp.service.metadata.enableByReferenceFilters = true
 
 # Set to shibboleth.LegacyAttributeRegistryResources to support only AttributeEncoders
 #idp.service.attribute.registry.resources = shibboleth.AttributeRegistryResources
diff --git a/idp-conf/src/main/resources/system/conf/metadata-providers-system.xml b/idp-conf/src/main/resources/system/conf/metadata-providers-system.xml
index c54996a..ef4ac1d 100644
--- a/idp-conf/src/main/resources/system/conf/metadata-providers-system.xml
+++ b/idp-conf/src/main/resources/system/conf/metadata-providers-system.xml
@@ -14,7 +14,8 @@
 
     <!-- BeanPostProcessors that auto-install MetadataFilters for internal use. -->
     
-    <bean class="net.shibboleth.idp.profile.spring.relyingparty.metadata.impl.ByReferenceFilterBeanPostProcessor" />
+    <bean class="net.shibboleth.idp.profile.spring.relyingparty.metadata.impl.ByReferenceFilterBeanPostProcessor"
+        p:enabled="%{idp.service.metadata.enableByReferenceFilters:true}" />
     
     <bean class="net.shibboleth.idp.profile.spring.relyingparty.metadata.impl.NodeProcessingAttachingBeanPostProcessor"
         c:service-ref="shibboleth.AttributeRegistryService" />
diff --git a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/ByReferenceFilterBeanPostProcessor.java b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/ByReferenceFilterBeanPostProcessor.java
index f2e6aa2..0d587ed 100644
--- a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/ByReferenceFilterBeanPostProcessor.java
+++ b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/ByReferenceFilterBeanPostProcessor.java
@@ -36,12 +36,31 @@ import net.shibboleth.idp.saml.metadata.impl.ByReferenceMetadataFilterBridge;
 /**
  * A {@link BeanPostProcessor} for {@link MetadataResolver} beans that ensures a {@link ByReferenceMetadataFilterBridge}
  * is attached.
+ * 
+ * @since 4.0.0
  */
 public class ByReferenceFilterBeanPostProcessor implements BeanPostProcessor, ApplicationContextAware, Ordered {
 
+    /** Whether to enable the processor. */
+    private boolean enabled;
+    
     /** Spring context. */
     @Nullable private ApplicationContext applicationContext;
 
+    /** Constructor. */
+    public ByReferenceFilterBeanPostProcessor() {
+        enabled = true;
+    }
+    
+    /**
+     * Set whether to enable the processor.
+     * 
+     * @param flag flag to set
+     */
+    public void setEnabled(final boolean flag) {
+        enabled = flag;
+    }
+    
     /** {@inheritDoc} */
     public int getOrder() {
         return HIGHEST_PRECEDENCE;
@@ -54,8 +73,9 @@ public class ByReferenceFilterBeanPostProcessor implements BeanPostProcessor, Ap
 
     /** {@inheritDoc} */
     @Override public Object postProcessBeforeInitialization(final Object bean, final String beanName) {
-        if (!(bean instanceof MetadataResolver) || bean instanceof ChainingMetadataResolver) {
-            // Do not attach to beans which just include other ones.
+        
+        // Do not attach to beans which just include other ones.
+        if (!enabled || !(bean instanceof MetadataResolver) || bean instanceof ChainingMetadataResolver) {
             return bean;
         }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list