[java-identity-provider] branch master updated: IDP-1519 - MFA transition action mishandles previous event determination

Scott Cantor cantor.2 at osu.edu
Wed Nov 13 14:20:52 EST 2019


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=4ac00a0d5ed22eece689c95de4c98d88eb7f3d15

The following commit(s) were added to refs/heads/master by this push:
       new  4ac00a0   IDP-1519 - MFA transition action mishandles previous event determination
4ac00a0 is described below

commit 4ac00a0d5ed22eece689c95de4c98d88eb7f3d15
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Nov 13 14:20:45 2019 -0500

    IDP-1519 - MFA transition action mishandles previous event determination
    
    https://issues.shibboleth.net/jira/browse/IDP-1519
---
 .../impl/TransitionMultiFactorAuthentication.java  | 31 +++++++++++++---------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/TransitionMultiFactorAuthentication.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/TransitionMultiFactorAuthentication.java
index d1aa4fb..84754db 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/TransitionMultiFactorAuthentication.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/TransitionMultiFactorAuthentication.java
@@ -100,6 +100,9 @@ public class TransitionMultiFactorAuthentication extends AbstractAuthenticationA
 
     /** A subordinate {@link MultiFactorAuthenticationContext}, if any. */
     @Nullable private MultiFactorAuthenticationContext mfaContext;
+    
+    /** Holds the last event processed by the system. */
+    @Nullable private String previousEvent;
 
     /** Constructor. */
     TransitionMultiFactorAuthentication() {
@@ -179,10 +182,13 @@ public class TransitionMultiFactorAuthentication extends AbstractAuthenticationA
         // Swap MFA flow back into top-level context so that other components see only MFA flow.
         authenticationContext.setAttemptedFlow(mfaContext.getAuthenticationFlowDescriptor());
 
-        // Event transitions require normalizing empty/null events into "proceed".
-        final EventContext eventCtx = eventContextLookupStrategy.apply(profileRequestContext);
-        final String previousEvent = eventCtx != null && eventCtx.getEvent() != null
-                ? eventCtx.getEvent().toString() : EventIds.PROCEED_EVENT_ID;
+        // If the holding variable is already set, this is a recursive invocation.
+        if (previousEvent == null) {
+            // Event transitions require normalizing empty/null events into "proceed".
+            final EventContext eventCtx = eventContextLookupStrategy.apply(profileRequestContext);
+            previousEvent = eventCtx != null && eventCtx.getEvent() != null
+                    ? eventCtx.getEvent().toString() : EventIds.PROCEED_EVENT_ID;
+        }
 
         // Check for an authentication result and move it into the MFA context.
         final AuthenticationResult result = authenticationContext.getAuthenticationResult();
@@ -232,7 +238,7 @@ public class TransitionMultiFactorAuthentication extends AbstractAuthenticationA
     }
 // Checkstyle: CyclomaticComplexity ON
 
-// Checkstyle: CyclomaticComplexity|ReturnCount OFF
+// Checkstyle: CyclomaticComplexity OFF
     /**
      * Respond to a signal to transition the MFA process to a new flow.
      * 
@@ -269,6 +275,7 @@ public class TransitionMultiFactorAuthentication extends AbstractAuthenticationA
             if (flow.getReuseCondition().test(profileRequestContext)) {
                 log.debug("{} Reusing active result for '{}' flow", getLogPrefix(), flowId);
                 activeResult.setLastActivityInstantToNow();
+                previousEvent = EventIds.PROCEED_EVENT_ID;
                 ActionSupport.buildProceedEvent(profileRequestContext);
                 doExecute(profileRequestContext, authenticationContext);
                 return;
@@ -279,19 +286,19 @@ public class TransitionMultiFactorAuthentication extends AbstractAuthenticationA
      
         if (validateLoginTransitions) {
             if (authenticationContext.isPassive() && !flow.isPassiveAuthenticationSupported()) {
-                log.error("{} Targeted login flow '{}' does not support passive authentication",
-                        getLogPrefix(), flowId);
+                log.error("{} Targeted login flow '{}' does not support passive authentication", getLogPrefix(),
+                        flowId);
                 ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_PASSIVE);
                 return;
             } else if ((authenticationContext.isForceAuthn() || authenticationContext.getMaxAge() != null)
                     && !flow.isForcedAuthenticationSupported()) {
-                log.error("{} Targeted login flow '{}' does not support forced re-authentication",
-                        getLogPrefix(), flowId);
+                log.error("{} Targeted login flow '{}' does not support forced re-authentication", getLogPrefix(),
+                        flowId);
                 ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.REQUEST_UNSUPPORTED);
                 return;
             } else if (!profileRequestContext.isBrowserProfile() && !flow.isNonBrowserSupported()) {
-                log.error("{} Targeted login flow '{}' does not support non-browser authentication",
-                        getLogPrefix(), flowId);
+                log.error("{} Targeted login flow '{}' does not support non-browser authentication", getLogPrefix(),
+                        flowId);
                 ActionSupport.buildEvent(profileRequestContext, authenticationContext.isPassive() ?
                         AuthnEventIds.NO_PASSIVE : AuthnEventIds.REQUEST_UNSUPPORTED);
                 return;
@@ -302,6 +309,6 @@ public class TransitionMultiFactorAuthentication extends AbstractAuthenticationA
         authenticationContext.setAttemptedFlow(flow);
         ActionSupport.buildProceedEvent(profileRequestContext);
     }
-// Checkstyle: CyclomaticComplexity|ReturnCount ON
+// Checkstyle: CyclomaticComplexity ON
     
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list