[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
Thu Jan 30 08:45:39 EST 2014


Author: rdw
Date: Thu Jan 30 08:45:39 2014
New Revision: 5277

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5277&view=rev
Log:
IDP-359 Per SAMKL-type format comparison

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/NameIDCanonicalization.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIdentifierCanonicalization.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/AbstractSAMLNameCanonicalization.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/AbstractSAMLNameCanonicalization.java?rev=5277&r1=5276&r2=5277&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/AbstractSAMLNameCanonicalization.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/AbstractSAMLNameCanonicalization.java Thu Jan 30 08:45:39 2014
@@ -87,29 +87,6 @@
     }
 
     /**
-     * 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
-     * @param duringAction true iff the method is run from the action above
-     * @return true if the format matches.
-     */
-    protected boolean formatMatches(@Nonnull String format, @Nonnull final ProfileRequestContext profileRequestContext,
-            @Nonnull final SubjectCanonicalizationContext c14nContext, final boolean duringAction) {
-        if (getFormats().contains(format)) {
-            return true;
-        }
-
-        if (duringAction) {
-            c14nContext.setException(new SubjectCanonicalizationException("Format not supported"));
-            ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.INVALID_SUBJECT);
-        }
-        return false;
-    }
-
-    /**
      * Check the provided responder against the one from the C14N context. If we are in the action then we log the error
      * into the C14N context and add the appropriate event to the ProfileRequest context
      * 

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIDCanonicalization.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIDCanonicalization.java?rev=5277&r1=5276&r2=5277&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIDCanonicalization.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIDCanonicalization.java Thu Jan 30 08:45:39 2014
@@ -36,6 +36,7 @@
 import org.opensaml.profile.action.ActionSupport;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.opensaml.saml.saml2.core.NameID;
+import org.opensaml.saml.saml2.profile.SAML2ObjectSupport;
 
 import com.google.common.base.Predicate;
 
@@ -98,6 +99,34 @@
         }
         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
+     * @param duringAction true iff the method is run from the action above
+     * @return true if the format matches.
+     */
+    protected boolean formatMatches(@Nonnull String format, @Nonnull final ProfileRequestContext profileRequestContext,
+            @Nonnull final SubjectCanonicalizationContext c14nContext, final boolean duringAction) {
+
+        for (String testFormat: getFormats()) {
+            if (SAML2ObjectSupport.areNameIdentifierFormatsEquivalent(testFormat, format)) {
+                return true;
+            }
+        }
+        
+        if (duringAction) {
+            c14nContext.setException(new SubjectCanonicalizationException("Format not supported"));
+            ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.INVALID_SUBJECT);
+        }
+        return false;
+    }
+
+
 
     /** {@inheritDoc} */
     @Override protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext,

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/NameIdentifierCanonicalization.java

[... 47 lines stripped ...]


More information about the commits mailing list