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

noreply at shibboleth.net noreply at shibboleth.net
Tue Jul 23 16:54:42 EDT 2013


Author: scantor
Date: Tue Jul 23 16:54:42 2013
New Revision: 4611

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4611&view=rev
Log:
Bit of cleanup on session API, lot more to do.

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

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/IdPSession.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/IdPSession.java?rev=4611&r1=4610&r2=4611&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/IdPSession.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/IdPSession.java Tue Jul 23 16:54:42 2013
@@ -32,21 +32,23 @@
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
+import net.shibboleth.utilities.java.support.annotation.constraint.Positive;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
 import net.shibboleth.utilities.java.support.component.IdentifiableComponent;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 import org.joda.time.DateTime;
-import org.opensaml.messaging.context.BaseContext;
 
 import com.google.common.base.Objects;
 import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableSet;
 
 /**
  * An identity provider session.
  */
 @ThreadSafe
-public final class IdPSession extends BaseContext implements IdentifiableComponent {
+public final class IdPSession implements IdentifiableComponent {
 
     /** Name of {@link org.slf4j.MDC} attribute that holds the current session ID: <code>idp.session.id</code>. */
     public static final String MDC_ATTRIBUTE = "idp.session.id";
@@ -63,17 +65,17 @@
     /** Last activity instant, in milliseconds since the epoch, for this session. */
     private long lastActivityInstant;
 
-    /** The authentication events that have occurred within the scope of this session. */
-    private final ConcurrentMap<String, AuthenticationResult> authenticationEvents;
-
-    /** The service which have been authenticated to in this session. */
+    /** Tracks authentication results that have occurred during this session. */
+    private final ConcurrentMap<String, AuthenticationResult> authenticationResults;
+
+    /** Tracks services which have been issued authentication tokens during this session. */
     private final ConcurrentMap<String, ServiceSession> serviceSessions;
 
     /**
-     * Lock used to serialize requests that operate on {@link #authenticationEvents} and {@link #serviceSessions} in the
-     * same call.
-     */
-    private final Lock authnServiceStateLock = new ReentrantLock();
+     * Lock used to serialize requests that operate on {@link #authenticationResults} and {@link #serviceSessions}
+     * in the same call.
+     */
+    private final Lock authnServiceStateLock;
 
     /**
      * Constructor.
@@ -81,18 +83,20 @@
      * @param sessionId identifier for this session
      * @param sessionSecret secrete for this session
      */
-    public IdPSession(@Nonnull @NotEmpty final String sessionId, @Nonnull byte[] sessionSecret) {
+    public IdPSession(@Nonnull @NotEmpty final String sessionId, @Nonnull final byte[] sessionSecret) {
         id = Constraint.isNotNull(StringSupport.trimOrNull(sessionId), "Session ID can not be null or empty");
 
-        Constraint.isNotNull(sessionSecret, "Session secret can not be null");
+        Constraint.isNotNull(sessionSecret, "Session secret cannot be null");
         secret = new byte[sessionSecret.length];
         System.arraycopy(sessionSecret, 0, secret, 0, sessionSecret.length);
 
         creationInstant = System.currentTimeMillis();
         lastActivityInstant = creationInstant;
 
-        authenticationEvents = new ConcurrentHashMap<String, AuthenticationResult>(5);
+        authenticationResults = new ConcurrentHashMap<String, AuthenticationResult>(5);
         serviceSessions = new ConcurrentHashMap<String, ServiceSession>(10);
+        
+        authnServiceStateLock = new ReentrantLock();
     }
 
     /** {@inheritDoc} */
@@ -101,7 +105,7 @@
     }
 
     /**
-     * Gets a secret associated with the session. This is useful for things like encrypting session cookies.
+     * Get a secret associated with the session. This is useful for things like encrypting session cookies.
      * 
      * @return secret associated with the session
      */
@@ -110,7 +114,7 @@
     }
 
     /**
-     * Gets the time, in milliseconds since the epoch, when this session was created.
+     * Get the time, in milliseconds since the epoch, when this session was created.
      * 

[... 278 lines stripped ...]


More information about the commits mailing list