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

noreply at shibboleth.net noreply at shibboleth.net
Tue Jun 11 05:39:02 EDT 2013


Author: rdw
Date: Tue Jun 11 05:39:01 2013
New Revision: 4530

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4530&view=rev
Log:
IDP-208 AttributeInMetadataMatcher changes to handle multi-mapped attributes and the case where attribute values were present but could not be decoded/

Modified:
    trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterContext.java
    trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/saml/AttributeInMetadataMatcher.java
    trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/impl/saml/AttributeInMetadataMatcherTest.java

Modified: trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterContext.java?rev=4530&r1=4529&r2=4530&view=diff
==============================================================================
--- trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterContext.java (original)
+++ trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterContext.java Tue Jun 11 05:39:01 2013
@@ -44,6 +44,7 @@
 import com.google.common.base.Predicates;
 import com.google.common.collect.Constraints;
 import com.google.common.collect.MapConstraints;
+import com.google.common.collect.Multimap;
 
 /** Context used to collect data as attributes are filtered. */
 @NotThreadSafe
@@ -57,9 +58,9 @@
 
     /** Values, for a given attribute, that are not permitted to be released. */
     private Map<String, Set<AttributeValue>> deniedValues;
-    
+
     /** The requested Attributes (from the metadata for this request). */
-    private Map<String, RequestedAttribute> requestedAttributes;
+    private Multimap<String, RequestedAttribute> requestedAttributes;
 
     /** Attributes which have been filtered. */
     private Map<String, Attribute> filteredAttributes;
@@ -227,26 +228,26 @@
         }
     }
 
-    /** Get the attributes requested in the ACS.
+    /**
+     * Get the attributes requested in the ACS.<br/>
+     * Note that a null requested attribute means that the attribute existed, but that no values could be converted.
+     * This is distinct from the attribute existing and having no values (an non null requested attribute, but an empty
+     * {@link Attribute#getValues()})
+     * 
      * @return Returns the requestedAttributes.
      */
-    public Map<String,RequestedAttribute> getRequestedAttributes() {
+    @NullableElements @Nonnull public Multimap<String, RequestedAttribute> getRequestedAttributes() {
         return requestedAttributes;
     }
 
-    /** Set the attributes requested by the ACS.
+    /**
+     * Set the attributes requested by the ACS.
+     * 
      * @param attributes The requestedAttributes to set.
      */
-    public void setRequestedAttributes(@Nullable @NullableElements final Collection<RequestedAttribute> attributes) {
-        Collection<RequestedAttribute> checkedAttributes = new ArrayList<RequestedAttribute>();
-        CollectionSupport.addIf(checkedAttributes, attributes, Predicates.notNull());
-
-        requestedAttributes =
-                MapConstraints.constrainedMap(new HashMap<String, RequestedAttribute>(checkedAttributes.size()),
-                        MapConstraints.notNull());
-
-        for (RequestedAttribute attribute : checkedAttributes) {
-            requestedAttributes.put(attribute.getId(), attribute);
-        }
+    public void
+            setRequestedAttributes(@Nullable @NullableElements final Multimap<String, RequestedAttribute> attributes) {
+
+        requestedAttributes = attributes;
     }
 }

Modified: trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/saml/AttributeInMetadataMatcher.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/saml/AttributeInMetadataMatcher.java?rev=4530&r1=4529&r2=4530&view=diff
==============================================================================
--- trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/saml/AttributeInMetadataMatcher.java (original)
+++ trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/saml/AttributeInMetadataMatcher.java Tue Jun 11 05:39:01 2013
@@ -17,9 +17,9 @@
 
 package net.shibboleth.idp.attribute.filter.impl.saml;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
 
 import javax.annotation.Nonnull;
@@ -36,6 +36,8 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Multimap;
 
 /**
  * Matcher that checks whether an attribute is enumerated in an SP's metadata as a required or optional attribute. Also

[... 144 lines stripped ...]


More information about the commits mailing list