[java-identity-provider] 02/02: IDP-1624 Preventing exporting DataConnectors from running during c14n

Rod Widdowson rdw at steadingsoftware.com
Thu Apr 22 15:39:18 UTC 2021


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

rdw 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=c918cc8bf9240b95df4b95c352418260f0581c5b

commit c918cc8bf9240b95df4b95c352418260f0581c5b
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Apr 22 16:36:39 2021 +0100

    IDP-1624 Preventing exporting DataConnectors from running during c14n
    
    https://issues.shibboleth.net/jira/browse/IDP-1624
    
    Add (and use) factory methods to ResolutionLabelPredicate to stop
    Spring trying to coerce a List<String> into a Predicate and
    complaining.
---
 .../resolver/logic/ResolutionLabelPredicate.java    | 21 ++++++++++++++++++++-
 .../resolver/spring/BaseResolverPluginParser.java   |  1 +
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/logic/ResolutionLabelPredicate.java b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/logic/ResolutionLabelPredicate.java
index dc4830d13..2bb1fb14d 100644
--- a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/logic/ResolutionLabelPredicate.java
+++ b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/logic/ResolutionLabelPredicate.java
@@ -57,4 +57,23 @@ public class ResolutionLabelPredicate extends StrategyIndirectedPredicate<Profil
         super(new ResolutionLabelLookupFunction(), pred);
     }
 
-}
\ No newline at end of file
+    /**
+     * Factory Method to avoid type-coercion warnings from Spring.
+     *
+     * @param candidates hardwired set of values to check against
+     * @return the result of calling {@link #ResolutionLabelPredicate(Collection)}
+     */
+    static ResolutionLabelPredicate byList(@Nonnull @NonnullElements final Collection<String> candidates) {
+        return new ResolutionLabelPredicate(candidates);
+    }
+
+    /**
+     * Factory Method to avoid type-coercion warnings fromSpring.
+     *
+     * @param pred generalized predicate
+     * @return the result of calling {@link #ResolutionLabelPredicate(Predicate)}
+     */
+    static ResolutionLabelPredicate byPredicate(@Nonnull final Predicate<String> pred) {
+        return new ResolutionLabelPredicate(pred);
+    }
+}
diff --git a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/BaseResolverPluginParser.java b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/BaseResolverPluginParser.java
index 485b2868a..b947e4a0e 100644
--- a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/BaseResolverPluginParser.java
+++ b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/BaseResolverPluginParser.java
@@ -160,6 +160,7 @@ public abstract class BaseResolverPluginParser extends AbstractCustomBeanDefinit
         } else if (config.hasAttributeNS(null, "excludeResolutionPhases")) {
             final BeanDefinitionBuilder unnegated =
                     BeanDefinitionBuilder.genericBeanDefinition(ResolutionLabelPredicate.class);
+            unnegated.setFactoryMethod("ofList");
             unnegated.addConstructorArgValue(
                     SpringSupport.getAttributeValueAsList(
                             config.getAttributeNodeNS(null, "excludeResolutionPhases")));

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


More information about the commits mailing list