[java-identity-provider COMMIT] /trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FinalizeAuthenticat...

noreply at shibboleth.net noreply at shibboleth.net
Wed Mar 19 18:07:44 EDT 2014


Author: scantor
Date: Wed Mar 19 18:07:43 2014
New Revision: 5612

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5612&view=rev
Log:
Remove c14n context after using it.

Modified:
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FinalizeAuthentication.java

Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FinalizeAuthentication.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FinalizeAuthentication.java?rev=5612&r1=5611&r2=5612&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FinalizeAuthentication.java (original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FinalizeAuthentication.java Wed Mar 19 18:07:43 2014
@@ -43,12 +43,15 @@
  * the completed {@link AuthenticationResult} and any other active results found in the
  * {@link AuthenticationContext}.</p>
  * 
+ * <p>Any {@link SubjectCanonicalizationContext} found will be removed.</p> 
+ * 
  * @event {@link org.opensaml.profile.action.EventIds#PROCEED_EVENT_ID}
- * @pre <pre>ProfileRequestContext.getSubcontext(AuthenticationContext.class, false) != null</pre>
+ * @pre <pre>ProfileRequestContext.getSubcontext(AuthenticationContext.class) != null</pre>
  * @post If SubjectCanonicalizationContext.getCanonicalPrincipalName() != null
  * || SessionContext.getIdPSession() != null
- * then ProfileRequestContext.getSubcontext(SubjectContext.class, false) != null 
+ * then ProfileRequestContext.getSubcontext(SubjectContext.class) != null 
  * @post AuthenticationContext.setCompletionInstant() was called
+ * @post <pre>ProfileRequestContext.getSubcontext(SubjectCanonicalizationContext.class) == null</pre>
  */
 public class FinalizeAuthentication extends AbstractAuthenticationAction {
 
@@ -60,14 +63,15 @@
     protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext,
             @Nonnull final AuthenticationContext authenticationContext) throws AuthenticationException {
 
-        SubjectCanonicalizationContext c14nCtx =
-                profileRequestContext.getSubcontext(SubjectCanonicalizationContext.class, false);
+        final SubjectCanonicalizationContext c14nCtx =
+                profileRequestContext.getSubcontext(SubjectCanonicalizationContext.class);
         if (c14nCtx != null) {
             canonicalPrincipalName = c14nCtx.getPrincipalName();
+            profileRequestContext.removeSubcontext(c14nCtx);
         }
         
         if (canonicalPrincipalName == null) {
-            SessionContext sessionCtx = profileRequestContext.getSubcontext(SessionContext.class, false);
+            final SessionContext sessionCtx = profileRequestContext.getSubcontext(SessionContext.class);
             if (sessionCtx != null && sessionCtx.getIdPSession() != null) {
                 canonicalPrincipalName = sessionCtx.getIdPSession().getPrincipalName();
             }
@@ -82,15 +86,15 @@
             @Nonnull final AuthenticationContext authenticationContext) throws AuthenticationException {
 
         if (canonicalPrincipalName != null) {
-            SubjectContext sc = profileRequestContext.getSubcontext(SubjectContext.class, true);
+            final SubjectContext sc = profileRequestContext.getSubcontext(SubjectContext.class, true);
             sc.setPrincipalName(canonicalPrincipalName);
 
-            Map scResults = sc.getAuthenticationResults();
+            final Map scResults = sc.getAuthenticationResults();
             scResults.putAll(authenticationContext.getActiveResults());
             
-            AuthenticationResult latest = authenticationContext.getAuthenticationResult();
+            final AuthenticationResult latest = authenticationContext.getAuthenticationResult();
             if (latest != null && !scResults.containsKey(latest.getAuthenticationFlowId())) {
-                    scResults.put(latest.getAuthenticationFlowId(), latest);
+                scResults.put(latest.getAuthenticationFlowId(), latest);
             }
         }
         



More information about the commits mailing list