[java-identity-provider COMMIT] in /trunk: idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filte...

noreply at shibboleth.net noreply at shibboleth.net
Mon Jun 16 05:02:34 EDT 2014


Author: rdw
Date: Mon Jun 16 05:02:33 2014
New Revision: 6088

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6088&view=rev
Log:
IDP-376 Checkpoint work on AttributeInMetadataPolicy plumbing.  Add a context to carry the ACS and navigation Functions to find XMLObjects from Contexts.  Add code to the filter to understand (but not exploit) this.

Added:
    trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/context/
    trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/context/AttributeConsumingServiceContext.java   (with props)
    trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/context/package-info.java   (with props)
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/profile/config/navigate/AttributeConsumerServiceLookupFunction.java   (with props)
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/profile/config/navigate/EntityDescriptorLookupFunction.java   (with props)
Modified:
    trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AttributeInMetadataPolicyRule.java

Modified: trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AttributeInMetadataPolicyRule.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AttributeInMetadataPolicyRule.java?rev=6088&r1=6087&r2=6088&view=diff
==============================================================================
--- trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AttributeInMetadataPolicyRule.java (original)
+++ trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AttributeInMetadataPolicyRule.java Mon Jun 16 05:02:33 2014
@@ -20,6 +20,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 import javax.annotation.Nonnull;
@@ -30,13 +31,22 @@
 import net.shibboleth.idp.attribute.IdPRequestedAttribute;
 import net.shibboleth.idp.attribute.filter.Matcher;
 import net.shibboleth.idp.attribute.filter.context.AttributeFilterContext;
+import net.shibboleth.idp.saml.attribute.mapping.AttributesMapContainer;
+import net.shibboleth.idp.saml.context.AttributeConsumingServiceContext;
+import net.shibboleth.idp.saml.profile.config.navigate.AttributeConsumerServiceLookupFunction;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
-
+import net.shibboleth.utilities.java.support.logic.Constraint;
+
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.messaging.context.navigate.ChildContextLookup;
+import org.opensaml.saml.common.messaging.context.SAMLMetadataContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Function;
+import com.google.common.base.Functions;
 import com.google.common.collect.Multimap;
 
 /**
@@ -57,6 +67,20 @@
     /** The String used to prefix log message. */
     private String logPrefix;
 
+    /** The strategy to get the appropriate XMLObject from the context. */
+    @Nonnull private Function<SAMLMetadataContext, ? extends XMLObject> objectStrategy;
+
+    /**
+     * Constructor.
+     * 
+     */
+    public AttributeInMetadataPolicyRule() {
+        objectStrategy =
+                Functions.compose(new AttributeConsumerServiceLookupFunction(),
+                        new ChildContextLookup<SAMLMetadataContext, AttributeConsumingServiceContext>(
+                                AttributeConsumingServiceContext.class));
+    }
+
     /**
      * Gets whether optionally requested attributes should be matched.
      * 
@@ -76,6 +100,24 @@
     }
 
     /**
+     * Get the strategy to get the appropriate XMLObject from the context.
+     * 
+     * @return Returns the strategy.
+     */
+    public Function<SAMLMetadataContext, ? extends XMLObject> getXMLObjectStrategy() {
+        return objectStrategy;
+    }
+
+    /**
+     * Set the strategy to get the appropriate XMLObject from the context.
+     * 
+     * @param strategy what to set.
+     */
+    public void setObjectStrategy(@Nonnull Function<SAMLMetadataContext, ? extends XMLObject> strategy) {
+        objectStrategy = Constraint.isNotNull(strategy, "ObjectStrategy must be non null");
+    }
+
+    /**
      * Gets whether to matched if the metadata contains no AttributeConsumingService.
      * 
      * @return whether to match if the metadata contains no AttributeConsumingService
@@ -91,6 +133,38 @@
      */
     public void setMatchIfMetadataSilent(final boolean flag) {
         matchIfMetadataSilent = flag;
+    }
+
+    /**
+     * Get the appropriate map of mapped attributes.
+     * 

[... 59 lines stripped ...]


More information about the commits mailing list