[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
Sun Jan 18 14:04:24 EST 2015


Author: scantor
Date: Sun Jan 18 14:04:24 2015
New Revision: 7255

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7255&view=rev
Log:
IDP-573 - trim source values and prevent all-whitespace

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
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/PersistentSAML2NameIDGenerator.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=7255&r1=7254&r2=7255&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 Sun Jan 18 14:04:24 2015
@@ -38,6 +38,7 @@
 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 net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 import org.opensaml.messaging.context.navigate.ChildContextLookup;
 import org.opensaml.profile.context.ProfileRequestContext;
@@ -192,8 +193,13 @@
                     return ((ScopedStringAttributeValue) value).getValue()
                             + delimiter + ((ScopedStringAttributeValue) value).getScope(); 
                 } else if (value instanceof StringAttributeValue) {
+                    final String strVal = StringSupport.trimOrNull((String) value.getValue());
+                    if (strVal == null) {
+                        log.debug("Skipping all-whitespace string value");
+                        continue;
+                    }
                     log.debug("Generating NameIdentifier from String-valued attribute {}", sourceId);
-                    return ((StringAttributeValue) value).getValue();
+                    return strVal;
                 } else {
                     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=7255&r1=7254&r2=7255&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGenerator.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGenerator.java Sun Jan 18 14:04:24 2015
@@ -38,6 +38,7 @@
 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 net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 import org.opensaml.messaging.context.navigate.ChildContextLookup;
 import org.opensaml.profile.context.ProfileRequestContext;
@@ -192,8 +193,13 @@
                     return ((ScopedStringAttributeValue) value).getValue()
                             + delimiter + ((ScopedStringAttributeValue) value).getScope(); 
                 } else if (value instanceof StringAttributeValue) {
+                    final String strVal = StringSupport.trimOrNull((String) value.getValue());
+                    if (strVal == null) {
+                        log.debug("Skipping all-whitespace string value");
+                        continue;
+                    }
                     log.debug("Generating NameID from String-valued attribute {}", sourceId);
-                    return ((StringAttributeValue) value).getValue();
+                    return strVal;
                 } else {
                     log.warn("Unrecognized attribute value type: {}", value.getClass().getName());
                 }

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

[... 34 lines stripped ...]


More information about the commits mailing list