[java-identity-provider COMMIT] in /trunk: idp-session-api/src/main/java/net/shibboleth/idp/session/IdPSession.java i...

noreply at shibboleth.net noreply at shibboleth.net
Sun Oct 13 20:52:56 EDT 2013


Author: scantor
Date: Sun Oct 13 20:52:56 2013
New Revision: 4853

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4853&view=rev
Log:
Missing a method to update result activity time.

Modified:
    trunk/idp-session-api/src/main/java/net/shibboleth/idp/session/IdPSession.java
    trunk/idp-session-api/src/test/java/net/shibboleth/idp/session/IdPSessionTest.java
    trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java
    trunk/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/StorageBackedSessionManagerTest.java

Modified: trunk/idp-session-api/src/main/java/net/shibboleth/idp/session/IdPSession.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-session-api/src/main/java/net/shibboleth/idp/session/IdPSession.java?rev=4853&r1=4852&r2=4853&view=diff
==============================================================================
--- trunk/idp-session-api/src/main/java/net/shibboleth/idp/session/IdPSession.java (original)
+++ trunk/idp-session-api/src/main/java/net/shibboleth/idp/session/IdPSession.java Sun Oct 13 20:52:56 2013
@@ -108,6 +108,17 @@
      */
     @Nullable public AuthenticationResult addAuthenticationResult(@Nonnull final AuthenticationResult result)
             throws SessionException;
+
+    /**
+     * Update the recorded activity timestamp for an {@link AuthenticationResult} associated with this
+     * session.
+     * 
+     * @param result the result to update
+     * 
+     * @throws SessionException if an error occurs updating the session
+     */
+    public void updateAuthenticationResultActivity(@Nonnull final AuthenticationResult result)
+            throws SessionException;
     
     /**
      * Disassociate an {@link AuthenticationResult} from this IdP session.

Modified: trunk/idp-session-api/src/test/java/net/shibboleth/idp/session/IdPSessionTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-session-api/src/test/java/net/shibboleth/idp/session/IdPSessionTest.java?rev=4853&r1=4852&r2=4853&view=diff
==============================================================================
--- trunk/idp-session-api/src/test/java/net/shibboleth/idp/session/IdPSessionTest.java (original)
+++ trunk/idp-session-api/src/test/java/net/shibboleth/idp/session/IdPSessionTest.java Sun Oct 13 20:52:56 2013
@@ -233,5 +233,10 @@
         public DummyIdPSession(String sessionId, String canonicalName) {
             super(sessionId, canonicalName, System.currentTimeMillis());
         }
+
+        /** {@inheritDoc} */
+        public void updateAuthenticationResultActivity(AuthenticationResult result) throws SessionException {
+
+        }
     }
 }

Modified: trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java?rev=4853&r1=4852&r2=4853&view=diff
==============================================================================
--- trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java (original)
+++ trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java Sun Oct 13 20:52:56 2013
@@ -239,6 +239,29 @@
                 throw new SessionException("Exception saving AuthenticationResult record to storage", e);
             }
             return null;
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void updateAuthenticationResultActivity(@Nonnull final AuthenticationResult result) throws SessionException {
+        String flowId = result.getAuthenticationFlowId();
+        AuthenticationFlowDescriptor flow = sessionManager.getAuthenticationFlowDescriptor(flowId);
+        if (flow != null) {
+            try {
+                if (sessionManager.getStorageService().updateExpiration(getId(), result.getAuthenticationFlowId(),
+                        result.getLastActivityInstant() + flow.getInactivityTimeout()) == null) {
+                    log.warn("Skipping update, AuthenticationResult for flow {} in session {} not found in storage",
+                            flowId, getId());
+                }
+            } catch (IOException e) {
+                log.error("Exception updating AuthenticationResult expiration for session " + getId()
+                        + " and flow " + flowId, e);
+                if (!sessionManager.isMaskStorageFailure()) {
+                    throw new SessionException("Exception updating AuthenticationResult expiration in storage", e);
+                }
+            }
+        } else {
+            log.warn("No flow descriptor installed for ID {}, unable to update result in storage", flowId);
         }
     }
 

Modified: trunk/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/StorageBackedSessionManagerTest.java

[... 285 lines stripped ...]


More information about the commits mailing list