[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 Jul 29 05:47:39 EDT 2013


Author: rdw
Date: Mon Jul 29 05:47:39 2013
New Revision: 4624

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4624&view=rev
Log:
IDP-207 First, gentle rework as a result of code review.  Second rework will be more radical.

Modified:
    trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/BaseAttributeValueMapper.java
    trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/ByteAttributeValueMapper.java
    trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/RequestedAttributeMapper.java
    trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/RequestedAttributesMapper.java
    trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/ScopedStringAttributeValueMapper.java
    trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/StringAttributeValueMapper.java
    trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/XmlObjectAttributeValueMapper.java
    trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/AttributeValueMapperTest.java

Modified: trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/BaseAttributeValueMapper.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/BaseAttributeValueMapper.java?rev=4624&r1=4623&r2=4624&view=diff
==============================================================================
--- trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/BaseAttributeValueMapper.java (original)
+++ trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/policyrule/saml/attributemapper/BaseAttributeValueMapper.java Mon Jul 29 05:47:39 2013
@@ -18,13 +18,20 @@
 package net.shibboleth.idp.attribute.filter.impl.policyrule.saml.attributemapper;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import net.shibboleth.idp.attribute.AttributeValue;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
 import net.shibboleth.utilities.java.support.component.AbstractInitializableComponent;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.component.ComponentSupport;
+import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.joda.time.DateTime;
 import org.opensaml.core.xml.XMLObject;
@@ -40,10 +47,9 @@
 
 /**
  * The base of the classes that map SAML2 attribute values into IdP attribute values.
- * 
  */
 public abstract class BaseAttributeValueMapper extends AbstractInitializableComponent {
-    
+
     /** logger. */
     private final Logger log = LoggerFactory.getLogger(BaseAttributeValueMapper.class);
 
@@ -51,12 +57,12 @@
     private String logPrefix;
 
     /**
-     * Convert from a list of the SAML Attributes into the IDP Attributes.
+     * Convert from a list of the SAML Objects (usually a SAML2 AttributeValue) Value into the IDP Attributes.
      * 
      * @param inputs the list of SAML Attributes
      * @return a list of IdP Attributes
      */
-    @Nonnull public List<AttributeValue> decodeValues(List<XMLObject> inputs) {
+    @Nonnull @Unmodifiable public List<AttributeValue> decodeValues(@Nonnull @NonnullElements List<XMLObject> inputs) {
         List<AttributeValue> outputs = new ArrayList<AttributeValue>(inputs.size());
 
         for (XMLObject input : inputs) {
@@ -65,7 +71,7 @@
                 outputs.add(output);
             }
         }
-        return outputs;
+        return Collections.unmodifiableList(outputs);
 
     }
 
@@ -75,30 +81,31 @@
      * @param object The object to inspect.
      * @return Its contents suitably decoded. Returns null if we could not decode.
      */
-    @Nullable protected String getStringValue(final XMLObject object) {
+    @Nullable protected String getStringValue(@Nonnull final XMLObject object) {
         String retVal = null;
+
+        if (object instanceof XSString) {
+
+            retVal = ((XSString) object).getValue();
+
+        } else if (object instanceof XSURI) {
+
+            retVal = ((XSURI) object).getValue();
+

[... 588 lines stripped ...]


More information about the commits mailing list