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

noreply at shibboleth.net noreply at shibboleth.net
Wed Jan 8 04:51:10 EST 2014


Author: rdw
Date: Wed Jan  8 04:51:10 2014
New Revision: 5165

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5165&view=rev
Log:
IDP-350 Request Specific attribute resolution by name rather than by Attribute

Modified:
    trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AttributeResolverImpl.java
    trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/context/AttributeResolutionContext.java
    trunk/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AttributeResolutionContextTest.java
    trunk/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AttributeResolverImplTest.java
    trunk/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/ResolveAttributesTest.java

Modified: trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AttributeResolverImpl.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AttributeResolverImpl.java?rev=5165&r1=5164&r2=5165&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AttributeResolverImpl.java (original)
+++ trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AttributeResolverImpl.java Wed Jan  8 04:51:10 2014
@@ -247,17 +247,15 @@
             @Nonnull final AttributeResolutionContext resolutionContext) {
         Constraint.isNotNull(resolutionContext, "Attribute resolution context can not be null");
 
-        final Collection<String> attributeIds = new LazyList<String>();
-        for (IdPAttribute requestedAttribute : resolutionContext.getRequestedIdPAttributes()) {
-            attributeIds.add(requestedAttribute.getId());
-        }
-
         // if no attributes requested, then resolve everything
-        if (attributeIds.isEmpty()) {
+        if (resolutionContext.getRequestedIdPAttributeNames().isEmpty()) {
+            final Collection<String> attributeIds = new LazyList<String>();
             attributeIds.addAll(attributeDefinitions.keySet());
-        }
-
-        return attributeIds;
+            return attributeIds;
+        } else {
+            return resolutionContext.getRequestedIdPAttributeNames();
+        }
+
     }
 
     /**

Modified: trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/context/AttributeResolutionContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/context/AttributeResolutionContext.java?rev=5165&r1=5164&r2=5165&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/context/AttributeResolutionContext.java (original)
+++ trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/context/AttributeResolutionContext.java Wed Jan  8 04:51:10 2014
@@ -49,8 +49,8 @@
 @NotThreadSafe
 public class AttributeResolutionContext extends BaseContext {
 
-    /** Attributes that have been requested to be resolved. */
-    @Nonnull @NonnullElements private Set<IdPAttribute> requestedAttributes;
+    /** (internal) Names of the attributes that have been requested to be resolved. */
+    @Nonnull @NonnullElements private Set<String> requestedAttributeNames;
 
     /** Attributes which were resolved and released by the attribute resolver. */
     @Nonnull @NonnullElements private Map<String, IdPAttribute> resolvedAttributes;
@@ -75,7 +75,7 @@
 
     /** Constructor. */
     public AttributeResolutionContext() {
-        requestedAttributes = Collections.emptySet();
+        requestedAttributeNames = Collections.emptySet();
 
         resolvedAttributes =
                 MapConstraints.constrainedMap(new HashMap<String, IdPAttribute>(), MapConstraints.notNull());
@@ -161,23 +161,23 @@
     }
 
     /**
-     * Gets the set of attributes requested to be resolved.
+     * Gets the (internal) names of the attributes requested to be resolved.
      * 
      * @return set of attributes requested to be resolved
      */
-    @Nonnull @NonnullElements public Set<IdPAttribute> getRequestedIdPAttributes() {
-        return requestedAttributes;
-    }
-
-    /**
-     * Sets the set of attributes requested to be resolved.
-     * 
-     * @param attributes attributes requested to be resolved
-     */
-    public void setRequestedIdPAttributes(@Nonnull @NonnullElements final Collection<IdPAttribute> attributes) {
-        Constraint.isNotNull(attributes, "Requested IdPAttribute collection cannot be null");
-
-        requestedAttributes = Sets.newHashSet(Collections2.filter(attributes, Predicates.notNull()));
+    @Nonnull @NonnullElements public Collection<String> getRequestedIdPAttributeNames() {
+        return requestedAttributeNames;
+    }
+
+    /**

[... 152 lines stripped ...]


More information about the commits mailing list