[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute: encoding/imp...

noreply at shibboleth.net noreply at shibboleth.net
Thu Jun 12 05:40:31 EDT 2014


Author: rdw
Date: Thu Jun 12 05:40:31 2014
New Revision: 6078

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6078&view=rev
Log:
IDP-376  Start to separate the Attribute type (requested or normal) out from the encoders to make mapping more general

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2ByteAttributeEncoder.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2ScopedStringAttributeEncoder.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2StringAttributeEncoder.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2XMLObjectAttributeEncoder.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/mapping/impl/RequestedAttributeMapper.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/mapping/impl/RequestedAttributesMapper.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2ByteAttributeEncoder.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2ByteAttributeEncoder.java?rev=6078&r1=6077&r2=6078&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2ByteAttributeEncoder.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2ByteAttributeEncoder.java Thu Jun 12 05:40:31 2014
@@ -21,52 +21,47 @@
 import javax.annotation.Nullable;
 
 import net.shibboleth.idp.attribute.AttributeEncodingException;
-import net.shibboleth.idp.attribute.IdPAttributeValue;
 import net.shibboleth.idp.attribute.ByteAttributeValue;
 import net.shibboleth.idp.attribute.IdPAttribute;
+import net.shibboleth.idp.attribute.IdPAttributeValue;
 import net.shibboleth.idp.attribute.IdPRequestedAttribute;
 import net.shibboleth.idp.saml.attribute.encoding.AbstractSAML2AttributeEncoder;
 import net.shibboleth.idp.saml.attribute.encoding.AttributeMapperFactory;
 import net.shibboleth.idp.saml.attribute.encoding.SAMLEncoderSupport;
+import net.shibboleth.idp.saml.attribute.mapping.AbstractSAMLAttributeMapper;
 import net.shibboleth.idp.saml.attribute.mapping.impl.ByteAttributeValueMapper;
-import net.shibboleth.idp.saml.attribute.mapping.impl.RequestedAttributeMapper;
 
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.saml.saml2.core.AttributeValue;
 import org.opensaml.saml.saml2.metadata.RequestedAttribute;
 
 /**
- * {@link net.shibboleth.idp.attribute.AttributeEncoder} that produces a SAML 2 Attribute from an
- * {@link IdPAttribute} that contains <code>byte[]</code> values.
+ * {@link net.shibboleth.idp.attribute.AttributeEncoder} that produces a SAML 2 Attribute from an {@link IdPAttribute}
+ * that contains <code>byte[]</code> values.
  */
 public class SAML2ByteAttributeEncoder extends AbstractSAML2AttributeEncoder<ByteAttributeValue> implements
         AttributeMapperFactory<RequestedAttribute, IdPRequestedAttribute> {
 
     /** {@inheritDoc} */
-    @Override
-    protected boolean canEncodeValue(@Nonnull final IdPAttribute attribute, @Nonnull final IdPAttributeValue value) {
+    @Override protected boolean canEncodeValue(@Nonnull final IdPAttribute attribute,
+            @Nonnull final IdPAttributeValue value) {
         return value instanceof ByteAttributeValue;
     }
 
     /** {@inheritDoc} */
-    @Override
-    @Nullable protected XMLObject encodeValue(@Nonnull final IdPAttribute attribute,
+    @Override @Nullable protected XMLObject encodeValue(@Nonnull final IdPAttribute attribute,
             @Nonnull final ByteAttributeValue value) throws AttributeEncodingException {
-        return SAMLEncoderSupport.encodeByteArrayValue(attribute,
-                AttributeValue.DEFAULT_ELEMENT_NAME, value.getValue());
+        return SAMLEncoderSupport
+                .encodeByteArrayValue(attribute, AttributeValue.DEFAULT_ELEMENT_NAME, value.getValue());
     }
 
     /** {@inheritDoc} */
-    @Nonnull public RequestedAttributeMapper getRequestedMapper() {
-        final RequestedAttributeMapper val;
+    @Override @Nonnull public void populateAttributeMapper(final
+            AbstractSAMLAttributeMapper<RequestedAttribute, IdPRequestedAttribute> mapper) {
+        mapper.setAttributeFormat(getNameFormat());
+        mapper.setId(getFriendlyName());
+        mapper.setSAMLName(getName());
+        mapper.setValueMapper(new ByteAttributeValueMapper());
+    }
 
-        val = new RequestedAttributeMapper();
-        val.setAttributeFormat(getNameFormat());
-        val.setId(getFriendlyName());
-        val.setSAMLName(getName());
-        val.setValueMapper(new ByteAttributeValueMapper());
-
-        return val;
-    }
-    
 }

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2ScopedStringAttributeEncoder.java

[... 338 lines stripped ...]


More information about the commits mailing list