[java-identity-provider] 01/01: IDP-1608 - Ability to supplement the list of default MetadataNodeProcessors

Scott Cantor cantor.2 at osu.edu
Tue Jun 2 00:02:22 UTC 2020


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

scantor pushed a commit to branch dev/IDP-1608
in repository java-identity-provider.

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

commit a797fd626db0db3f487c3e61ba755f27adb1f3c8
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Jun 1 20:01:57 2020 -0400

    IDP-1608 - Ability to supplement the list of default
    MetadataNodeProcessors
    
    https://issues.shibboleth.net/jira/browse/IDP-1608
---
 .../system/conf/metadata-providers-system.xml          |  3 ++-
 .../impl/NodeProcessingAttachingBeanPostProcessor.java | 18 ++++++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

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 ef4ac1d32..5407fb850 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
@@ -18,7 +18,8 @@
         p:enabled="%{idp.service.metadata.enableByReferenceFilters:true}" />
     
     <bean class="net.shibboleth.idp.profile.spring.relyingparty.metadata.impl.NodeProcessingAttachingBeanPostProcessor"
-        c:service-ref="shibboleth.AttributeRegistryService" />
+        c:service-ref="shibboleth.AttributeRegistryService"
+        p:enabled="%{idp.service.metadata.enableDefaultNodeProcessors:true}" />
     
     <!-- Signature Validation Criteria  -->
     
diff --git a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/NodeProcessingAttachingBeanPostProcessor.java b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/NodeProcessingAttachingBeanPostProcessor.java
index 833318c4b..f9859d48e 100644
--- a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/NodeProcessingAttachingBeanPostProcessor.java
+++ b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/NodeProcessingAttachingBeanPostProcessor.java
@@ -54,6 +54,9 @@ import net.shibboleth.utilities.java.support.service.ReloadableService;
  */
 public class NodeProcessingAttachingBeanPostProcessor implements BeanPostProcessor, Ordered {
 
+    /** Whether to enable the processor. */
+    private boolean enabled;
+
     /** The registry of decoding rules. */
     @Nullable private final ReloadableService<AttributeTranscoderRegistry> transcoderRegistry;
 
@@ -65,6 +68,7 @@ public class NodeProcessingAttachingBeanPostProcessor implements BeanPostProcess
     public NodeProcessingAttachingBeanPostProcessor(
             @Nullable @ParameterName(name="service") final ReloadableService<AttributeTranscoderRegistry> service) {
         transcoderRegistry = service;
+        enabled = true;
     }
 
     /** {@inheritDoc} */
@@ -72,11 +76,21 @@ public class NodeProcessingAttachingBeanPostProcessor implements BeanPostProcess
         return LOWEST_PRECEDENCE;
     }
     
+    /**
+     * Set whether to enable the processor.
+     * 
+     * @param flag flag to set
+     */
+    public void setEnabled(final boolean flag) {
+        enabled = flag;
+    }
+    
     // Checkstyle: CyclomaticComplexity OFF
     /** {@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