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

noreply at shibboleth.net noreply at shibboleth.net
Sun Jan 18 14:35:50 EST 2015


Author: scantor
Date: Sun Jan 18 14:35:49 2015
New Revision: 7257

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7257&view=rev
Log:
IDP-573 - Match V2 behavior by checking for all-whitespace, but don't trim.

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

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML1StringNameIdentifierEncoder.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML1StringNameIdentifierEncoder.java?rev=7257&r1=7256&r2=7257&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML1StringNameIdentifierEncoder.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML1StringNameIdentifierEncoder.java Sun Jan 18 14:35:49 2015
@@ -129,15 +129,19 @@
         nameId.setFormat(format);
         nameId.setNameQualifier(qualifier);
 
-        for (IdPAttributeValue attrValue : attributeValues) {
+        for (final IdPAttributeValue attrValue : attributeValues) {
             if (attrValue == null || attrValue.getValue() == null) {
-                // Should not be null, but check anyway
                 log.debug("Skipping null value of attribute {}", attributeId);
                 continue;
             }
-            Object value = attrValue.getValue();
-
+            
+            final Object value = attrValue.getValue();
             if (value instanceof String) {
+                // Check for empty or all-whitespace, but don't trim.
+                if (StringSupport.trimOrNull((String) value) == null) {
+                    log.debug("Skipping all-whitespace value of attribute {}", attributeId);
+                    continue;
+                }
                 nameId.setValue((String) value);
                 return nameId;
             } else {

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2StringNameIDEncoder.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2StringNameIDEncoder.java?rev=7257&r1=7256&r2=7257&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2StringNameIDEncoder.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/encoding/impl/SAML2StringNameIDEncoder.java Sun Jan 18 14:35:49 2015
@@ -129,15 +129,19 @@
         nameId.setFormat(format);
         nameId.setNameQualifier(qualifier);
 
-        for (IdPAttributeValue attrValue : attributeValues) {
+        for (final IdPAttributeValue attrValue : attributeValues) {
             if (attrValue == null || attrValue.getValue() == null) {
-                // Should not be null, but check anyway
                 log.debug("Skipping null value of attribute {}", attributeId);
                 continue;
             }
+            
             Object value = attrValue.getValue();
-
             if (value instanceof String) {
+                // Check for empty or all-whitespace, but don't trim.
+                if (StringSupport.trimOrNull((String) value) == null) {
+                    log.debug("Skipping all-whitespace value of attribute {}", attributeId);
+                    continue;
+                }
                 nameId.setValue((String) value);
                 return nameId;
             } else {



More information about the commits mailing list