[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl: AttributeS...

noreply at shibboleth.net noreply at shibboleth.net
Mon Jul 7 21:35:43 EDT 2014


Author: scantor
Date: Mon Jul  7 21:35:43 2014
New Revision: 6239

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6239&view=rev
Log:
IDP-362: make scoped delimiter configurable

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGenerator.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java?rev=6239&r1=6238&r2=6239&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java Mon Jul  7 21:35:43 2014
@@ -67,6 +67,9 @@
     /** Strategy function to lookup AttributeContext. */
     @Nonnull private Function<ProfileRequestContext,AttributeContext> attributeContextLookupStrategy;
     
+    /** Delimiter to use for scoped attribute serialization. */
+    private char delimiter;
+    
     /** Attribute(s) to use as an identifier source. */
     @Nonnull @NonnullElements private List<String> attributeSourceIds;
     
@@ -75,6 +78,7 @@
         attributeContextLookupStrategy = Functions.compose(
                 new ChildContextLookup<RelyingPartyContext,AttributeContext>(AttributeContext.class),
                 new ChildContextLookup<ProfileRequestContext,RelyingPartyContext>(RelyingPartyContext.class));
+        delimiter = '@';
         attributeSourceIds = Collections.emptyList();
         setDefaultIdPNameQualifierLookupStrategy(new ResponderIdLookupFunction());
         setDefaultSPNameQualifierLookupStrategy(new RelyingPartyIdLookupFunction());
@@ -85,12 +89,23 @@
      * 
      * @param strategy lookup function to use
      */
-    public synchronized void setAttributeContextLookupStrategy(
+    public void setAttributeContextLookupStrategy(
             @Nonnull final Function<ProfileRequestContext, AttributeContext> strategy) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
         
         attributeContextLookupStrategy = Constraint.isNotNull(strategy,
                 "AttributeContext lookup strategy cannot be null");
+    }
+    
+    /**
+     * Set the delimiter to use for serializing scoped attribute values.
+     * 
+     * @param ch
+     */
+    public void setScopedDelimiter(final char ch) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        
+        delimiter = ch;
     }
     
     /**
@@ -98,7 +113,7 @@
      * 
      * @param ids   attribute IDs to pull from
      */
-    public synchronized void setAttributeSourceIds(@Nonnull @NonnullElements final List<String> ids) {
+    public void setAttributeSourceIds(@Nonnull @NonnullElements final List<String> ids) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
         Constraint.isNotNull(ids, "Attribute ID collection cannot be null");
         
@@ -174,14 +189,14 @@
             final Set<IdPAttributeValue<?>> values = attribute.getValues();
             for (final IdPAttributeValue value : values) {
                 if (value instanceof ScopedStringAttributeValue) {
-                    log.info("Generating NameIdentifier from Scoped String-valued attribute {}", sourceId);
+                    log.debug("Generating NameIdentifier from Scoped String-valued attribute {}", sourceId);
                     return ((ScopedStringAttributeValue) value).getValue()
-                            + '@' + ((ScopedStringAttributeValue) value).getScope(); 
+                            + delimiter + ((ScopedStringAttributeValue) value).getScope(); 
                 } else if (value instanceof StringAttributeValue) {
-                    log.info("Generating NameIdentifier from String-valued attribute {}", sourceId);
+                    log.debug("Generating NameIdentifier from String-valued attribute {}", sourceId);
                     return ((StringAttributeValue) value).getValue();
                 } else {
-                    log.info("Unrecognized attribute value type: {}", value.getClass().getName());
+                    log.warn("Unrecognized attribute value type: {}", value.getClass().getName());
                 }
             }
         }

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGenerator.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGenerator.java?rev=6239&r1=6238&r2=6239&view=diff

[... 75 lines stripped ...]


More information about the commits mailing list