[java-identity-provider COMMIT] in /trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl: StorageBack...

noreply at shibboleth.net noreply at shibboleth.net
Tue Oct 22 14:50:18 EDT 2013


Author: scantor
Date: Tue Oct 22 14:50:17 2013
New Revision: 4900

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4900&view=rev
Log:
Implement non-caching of results while still creating a session for other purposes.

Modified:
    trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
    trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/UpdateSessionWithAuthenticationResult.java

Modified: trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java?rev=4900&r1=4899&r2=4900&view=diff
==============================================================================
--- trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java (original)
+++ trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java Tue Oct 22 14:50:17 2013
@@ -18,7 +18,6 @@
 package net.shibboleth.idp.session.impl;
 
 import java.io.IOException;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;

Modified: trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/UpdateSessionWithAuthenticationResult.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/UpdateSessionWithAuthenticationResult.java?rev=4900&r1=4899&r2=4900&view=diff
==============================================================================
--- trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/UpdateSessionWithAuthenticationResult.java (original)
+++ trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/UpdateSessionWithAuthenticationResult.java Tue Oct 22 14:50:17 2013
@@ -45,7 +45,8 @@
  * one.
  * 
  * <p>A new {@link AuthenticationResult} may be added to the session, or the last activity time
- * of an existing one updated.</p>
+ * of an existing one updated. A new one will only be added if the authentication context indicates
+ * that the result is "cacheable".</p>
  * 
  * <p>An existing session is identified via a {@link SessionContext} attached to the
  * {@link ProfileRequestContext}. If a new session is created, it will be placed into a
@@ -120,8 +121,7 @@
     protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext,
             @Nonnull final AuthenticationContext authenticationContext) throws AuthenticationException {
 
-        if (enabled && authenticationContext.getAuthenticationResult() != null
-                && authenticationContext.isResultCacheable()) {
+        if (enabled && authenticationContext.getAuthenticationResult() != null) {
             subjectCtx = profileRequestContext.getSubcontext(SubjectContext.class, false);
             sessionCtx = profileRequestContext.getSubcontext(SessionContext.class, true);
             
@@ -168,9 +168,11 @@
             @Nonnull final IdPSession session) throws SessionException {
         
         if (authenticationContext.getAttemptedFlow() != null) {
-            log.info("{} Adding new AuthenticationResult for flow {} to existing session {}", getLogPrefix(),
-                    authenticationContext.getAuthenticationResult().getAuthenticationFlowId(), session.getId());
-            session.addAuthenticationResult(authenticationContext.getAuthenticationResult());
+            if (authenticationContext.isResultCacheable()) {
+                log.info("{} Adding new AuthenticationResult for flow {} to existing session {}", getLogPrefix(),
+                        authenticationContext.getAuthenticationResult().getAuthenticationFlowId(), session.getId());
+                session.addAuthenticationResult(authenticationContext.getAuthenticationResult());
+            }
         } else {
             log.info("{} Updating activity time on reused AuthenticationResult for flow {} in existing session {}",
                     getLogPrefix(), authenticationContext.getAuthenticationResult().getAuthenticationFlowId(),
@@ -191,6 +193,8 @@
         log.info("{} Creating new session for principal {}", getLogPrefix(), subjectCtx.getPrincipalName());
         
         sessionCtx.setIdPSession(sessionManager.createSession(subjectCtx.getPrincipalName()));
-        sessionCtx.getIdPSession().addAuthenticationResult(authenticationContext.getAuthenticationResult());
+        if (authenticationContext.isResultCacheable()) {
+            sessionCtx.getIdPSession().addAuthenticationResult(authenticationContext.getAuthenticationResult());
+        }
     }
 }



More information about the commits mailing list