[java-shib-common COMMIT] in /branches/REL_1: doc/RELEASE-NOTES.txt src/main/java/edu/internet2/middleware/shibboleth...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Oct 17 21:02:22 EDT 2014
Author: scantor
Date: Fri Oct 17 21:02:22 2014
New Revision: 1108
URL: http://svn.shibboleth.net/view/java-shib-common?rev=1108&view=rev
Log:
SC-196 - IdP will send empty Subject:NameID in assertion
Modified:
branches/REL_1/doc/RELEASE-NOTES.txt
branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/encoding/provider/SAML1StringNameIdentifierEncoder.java
branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/encoding/provider/SAML2StringNameIDEncoder.java
Modified: branches/REL_1/doc/RELEASE-NOTES.txt
URL: http://svn.shibboleth.net/view/java-shib-common/branches/REL_1/doc/RELEASE-NOTES.txt?rev=1108&r1=1107&r2=1108&view=diff
==============================================================================
--- branches/REL_1/doc/RELEASE-NOTES.txt (original)
+++ branches/REL_1/doc/RELEASE-NOTES.txt Fri Oct 17 21:02:22 2014
@@ -1,3 +1,7 @@
+Changes in Release 1.4.3
+=============================================
+[SC-196] - IdP will send empty Subject:NameID in assertion
+
Changes in Release 1.4.2
=============================================
[SC-194] - Update vt-ldap to 3.3.8
Modified: branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/encoding/provider/SAML1StringNameIdentifierEncoder.java
URL: http://svn.shibboleth.net/view/java-shib-common/branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/encoding/provider/SAML1StringNameIdentifierEncoder.java?rev=1108&r1=1107&r2=1108&view=diff
==============================================================================
--- branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/encoding/provider/SAML1StringNameIdentifierEncoder.java (original)
+++ branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/encoding/provider/SAML1StringNameIdentifierEncoder.java Fri Oct 17 21:02:22 2014
@@ -70,23 +70,29 @@
/** {@inheritDoc} */
public NameIdentifier encode(BaseAttribute attribute) throws AttributeEncodingException {
- NameIdentifier nameId = identifierBuilder.buildObject();
-
- if (attribute.getValues() == null || attribute.getValues().isEmpty()) {
- throw new AttributeEncodingException(attribute.getId()
- + " attribute does not contain any values to encode");
+ if (attribute.getValues() != null) {
+ for (final Object value : attribute.getValues()) {
+ // Check for null, empty, or solely whitespace. But don't trim the value encoded.
+ final String valueStr = value.toString();
+ if (DatatypeHelper.safeTrimOrNullString(valueStr) != null) {
+ NameIdentifier nameId = identifierBuilder.buildObject();
+ nameId.setNameIdentifier(valueStr);
+
+ if (nameFormat != null) {
+ nameId.setFormat(nameFormat);
+ }
+
+ if (nameQualifier != null) {
+ nameId.setNameQualifier(nameQualifier);
+ }
+
+ return nameId;
+ }
+ }
}
- nameId.setNameIdentifier(attribute.getValues().iterator().next().toString());
-
- if (nameFormat != null) {
- nameId.setFormat(nameFormat);
- }
-
- if (nameQualifier != null) {
- nameId.setNameQualifier(nameQualifier);
- }
-
- return nameId;
+
+ throw new AttributeEncodingException(attribute.getId()
+ + " attribute does not contain any non-empty values to encode");
}
}
Modified: branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/encoding/provider/SAML2StringNameIDEncoder.java
URL: http://svn.shibboleth.net/view/java-shib-common/branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/encoding/provider/SAML2StringNameIDEncoder.java?rev=1108&r1=1107&r2=1108&view=diff
==============================================================================
--- branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/encoding/provider/SAML2StringNameIDEncoder.java (original)
+++ branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/encoding/provider/SAML2StringNameIDEncoder.java Fri Oct 17 21:02:22 2014
@@ -49,22 +49,29 @@
/** {@inheritDoc} */
public NameID encode(BaseAttribute attribute) throws AttributeEncodingException {
- NameID nameId = nameIdBuilder.buildObject();
-
- if (attribute.getValues() == null || attribute.getValues().isEmpty()) {
- throw new AttributeEncodingException(attribute.getId() + " attribute does not contain any values to encode");
+ if (attribute.getValues() != null) {
+ for (final Object value : attribute.getValues()) {
+ // Check for null, empty, or solely whitespace. But don't trim the value encoded.
+ final String valueStr = value.toString();
[... 34 lines stripped ...]
More information about the commits
mailing list