[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/impl/nameid/AbstractSA...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Feb 21 12:30:20 EST 2014
Author: rdw
Date: Fri Feb 21 12:30:20 2014
New Revision: 5437
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5437&view=rev
Log:
IdP 359 Align the NameIdentifier C14N with the NameID one and remove now-redudant base class
Modified:
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/AbstractSAMLNameCanonicalization.java
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIdentifierCanonicalization.java
trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/NameIdentifierCanonicalizationTest.java
Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIdentifierCanonicalization.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIdentifierCanonicalization.java?rev=5437&r1=5436&r2=5437&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIdentifierCanonicalization.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIdentifierCanonicalization.java Fri Feb 21 12:30:20 2014
@@ -22,11 +22,14 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.idp.authn.AbstractSubjectCanonicalizationAction;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.SubjectCanonicalizationException;
+import net.shibboleth.idp.authn.SubjectCanonicalizationFlowDescriptor;
import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
import net.shibboleth.idp.saml.authn.principal.NameIdentifierPrincipal;
import net.shibboleth.idp.saml.nameid.NameDecoderException;
+import net.shibboleth.idp.saml.nameid.NameIDCanonicalizationFlowDescriptor;
import net.shibboleth.idp.saml.nameid.NameIdentifierDecoder;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
@@ -37,6 +40,8 @@
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.saml.saml1.core.NameIdentifier;
import org.opensaml.saml.saml1.profile.SAML1ObjectSupport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Predicate;
@@ -55,10 +60,7 @@
* SubjectCanonicalizationContext.getPrincipalName() != null || SubjectCanonicalizationContext.getException() != null
* </pre>
*/
-public class NameIdentifierCanonicalization extends AbstractSAMLNameCanonicalization {
-
- /** The custom Principal to operate on. */
- @Nullable private String transientPrincipal;
+public class NameIdentifierCanonicalization extends AbstractSubjectCanonicalizationAction {
/** Supplies logic for pre-execute test. */
@Nonnull private final ActivationCondition embeddedPredicate;
@@ -100,64 +102,42 @@
super.doInitialize();
}
- /**
- * Check the format against the format list. If we are in the action then we log the error into the C14N context and
- * add the appropriate event to the ProfileRequest context
- *
- * @param format the format to check
- * @param profileRequestContext the current profile request context
- * @param c14nContext the current c14n context
- * @return true if the format matches.
- */
- protected boolean formatMatches(@Nonnull String format, @Nonnull final ProfileRequestContext profileRequestContext,
- @Nonnull final SubjectCanonicalizationContext c14nContext) {
-
- for (String testFormat : getFormats()) {
- if (SAML1ObjectSupport.areNameIdentifierFormatsEquivalent(testFormat, format)) {
- return true;
- }
- }
-
- return false;
- }
-
/** {@inheritDoc} */
@Override protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext,
@Nonnull final SubjectCanonicalizationContext c14nContext) throws SubjectCanonicalizationException {
- if (embeddedPredicate.apply(profileRequestContext, c14nContext, true)) {
-
- final Set<NameIdentifierPrincipal> nameIdentifiers =
- c14nContext.getSubject().getPrincipals(NameIdentifierPrincipal.class);
- final NameIdentifier nameIdentifier = nameIdentifiers.iterator().next().getNameIdentifier();
-
- try {
- transientPrincipal =
- decoder.decode(nameIdentifier, c14nContext.getResponderId(), c14nContext.getRequesterId());
- } catch (SubjectCanonicalizationException e) {
- c14nContext.setException(e);
- ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.INVALID_SUBJECT);
- return false;
- } catch (NameDecoderException e) {
- c14nContext.setException(e);
- ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.SUBJECT_C14N_ERROR);
- return false;
[... 180 lines stripped ...]
More information about the commits
mailing list