[java-identity-provider COMMIT] in /trunk: idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationResult....

noreply at shibboleth.net noreply at shibboleth.net
Tue Sep 15 22:38:54 EDT 2015


Author: scantor
Date: Tue Sep 15 22:38:54 2015
New Revision: 7755

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7755&view=rev
Log:
IDP-800 - track initial AuthnResult to prevent double login

Modified:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationResult.java
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java
    trunk/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/BuildAuthenticationContextAction.java

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationResult.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationResult.java?rev=7755&r1=7754&r2=7755&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationResult.java	(original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationResult.java	Tue Sep 15 22:38:54 2015
@@ -174,8 +174,8 @@
         }
 
         if (obj instanceof AuthenticationResult) {
-            return Objects.equals(getAuthenticationFlowId(),
-                    ((AuthenticationResult) obj).getAuthenticationFlowId());
+            return Objects.equals(getAuthenticationFlowId(), ((AuthenticationResult) obj).getAuthenticationFlowId())
+                    && getAuthenticationInstant() == ((AuthenticationResult) obj).getAuthenticationInstant();
         }
 
         return false;

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java?rev=7755&r1=7754&r2=7755&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java	(original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java	Tue Sep 15 22:38:54 2015
@@ -81,8 +81,11 @@
     
     /** Signals authentication flow to run next, to influence selection logic. */
     @Nullable private String signaledFlowId;
-    
-    /** A successfully processed authentication result (the output of the attempted flow, if any). */
+
+    /** A successful "initial" authentication result from the current request's initial-authn phase. */
+    @Nullable private AuthenticationResult initialAuthenticationResult;
+
+    /** A successful authentication result (the output of the attempted flow, if any). */
     @Nullable private AuthenticationResult authenticationResult;
 
     /** Result may be cached for reuse in the normal way. */
@@ -286,6 +289,31 @@
         signaledFlowId = StringSupport.trimOrNull(id);
         return this;
     }    
+
+    /**
+     * Get the "initial" authentication result produced during this request's initial-authn phase.
+     * 
+     * <p>This is used to make a previous result available for SSO even if the "forced authentication"
+     * feature is being used, since the result was produced as part of the same request.</p>
+     * 
+     * @return "initial" authentication result, if any
+     */
+    @Nullable public AuthenticationResult getInitialAuthenticationResult() {
+        return initialAuthenticationResult;
+    }
+
+    /**
+     * Set the "initial" authentication result produced during this request's initial-authn phase.
+     * 
+     * @param result "initial" authentication result, if any
+     * 
+     * @return this authentication context
+     */
+    @Nonnull public AuthenticationContext setInitialAuthenticationResult(
+            @Nullable final AuthenticationResult result) {
+        initialAuthenticationResult = result;
+        return this;
+    }
     
     /**
      * Get the authentication result produced by the attempted flow, or reused for SSO.
@@ -398,6 +426,8 @@
                 .add("attemptedFlow", attemptedFlow)
                 .add("signaledFlowId", signaledFlowId)
                 .add("resultCacheable", resultCacheable)
+                .add("initialAuthenticationResult", initialAuthenticationResult)
+                .add("authenticationResult", authenticationResult)
                 .add("completionInstant", new DateTime(completionInstant))
                 .toString();
     }

Modified: trunk/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/BuildAuthenticationContextAction.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/BuildAuthenticationContextAction.java?rev=7755&r1=7754&r2=7755&view=diff
==============================================================================
--- trunk/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/BuildAuthenticationContextAction.java	(original)
+++ trunk/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/BuildAuthenticationContextAction.java	Tue Sep 15 22:38:54 2015

[... 49 lines stripped ...]


More information about the commits mailing list