[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/impl/nameid/DefaultSAM...
noreply at shibboleth.net
noreply at shibboleth.net
Thu Jan 23 15:43:47 EST 2014
Author: scantor
Date: Thu Jan 23 15:43:47 2014
New Revision: 5234
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5234&view=rev
Log:
IDP-362: Allow generators to return null, add unit test and format validation to SAML 1 plugin
Added:
trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/
trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DefaultSAML1NameIdentifierGeneratorTest.java (with props)
Modified:
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/DefaultSAML1NameIdentifierGenerator.java
Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/DefaultSAML1NameIdentifierGenerator.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/DefaultSAML1NameIdentifierGenerator.java?rev=5234&r1=5233&r2=5234&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/DefaultSAML1NameIdentifierGenerator.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/DefaultSAML1NameIdentifierGenerator.java Thu Jan 23 15:43:47 2014
@@ -44,6 +44,7 @@
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.saml.saml1.core.NameIdentifier;
import org.opensaml.saml.saml1.profile.AbstractSAML1NameIdentifierGenerator;
+import org.opensaml.saml.saml1.profile.SAML1ObjectSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -120,7 +121,9 @@
protected void doInitialize() throws ComponentInitializationException {
super.doInitialize();
- Constraint.isNotEmpty(attributeSourceIds, "Attribute source ID list cannot be empty");
+ if (attributeSourceIds.isEmpty()) {
+ throw new ComponentInitializationException("Attribute source ID list cannot be empty");
+ }
}
/** {@inheritDoc} */
@@ -147,8 +150,13 @@
final Set<IdPAttributeValue<?>> values = attribute.getValues();
for (final IdPAttributeValue value : values) {
if (value instanceof XMLObjectAttributeValue && value.getValue() instanceof NameIdentifier) {
- log.info("Returning NameIdentifier from XMLObject-valued attribute {}", sourceId);
- return (NameIdentifier) value.getValue();
+ if (SAML1ObjectSupport.areNameIdentifierFormatsEquivalent(getFormat(),
+ ((NameIdentifier) value.getValue()).getFormat())) {
+ log.info("Returning NameIdentifier from XMLObject-valued attribute {}", sourceId);
+ return (NameIdentifier) value.getValue();
+ } else {
+ log.debug("Attribute {} value was NameIdentifier, but Format did not match", sourceId);
+ }
}
}
}
More information about the commits
mailing list