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

noreply at shibboleth.net noreply at shibboleth.net
Wed Sep 18 11:39:22 EDT 2013


Author: scantor
Date: Wed Sep 18 11:39:22 2013
New Revision: 4774

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4774&view=rev
Log:
Session API revisions

Modified:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/IdPSession.java
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/ServiceSession.java
    trunk/idp-authn-api/src/test/java/net/shibboleth/idp/session/IdPSessionTest.java
    trunk/idp-authn-api/src/test/java/net/shibboleth/idp/session/ServiceSessionTest.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=4774&r1=4773&r2=4774&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 Wed Sep 18 11:39:22 2013
@@ -17,18 +17,16 @@
 
 package net.shibboleth.idp.session;
 
-import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.ThreadSafe;
 
 import net.shibboleth.idp.authn.AuthenticationResult;
+import net.shibboleth.utilities.java.support.annotation.Duration;
 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;
@@ -39,13 +37,14 @@
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 import org.joda.time.DateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Objects;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSet;
 
 /**
- * An identity provider session.
+ * An identity provider session belonging to a particular subject and client device.
  */
 @ThreadSafe
 public final class IdPSession implements IdentifiableComponent {
@@ -53,64 +52,63 @@
     /** 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";
 
+    /** Class logger. */
+    @Nonnull private final Logger log = LoggerFactory.getLogger(IdPSession.class);
+    
     /** Unique ID of this session. */
-    private final String id;
-
-    /** Secret associated with this session. */
-    private final byte[] secret;
+    @Nonnull @NotEmpty private final String id;
+    
+    /** A canonical name for the subject of the session. */
+    @Nonnull @NotEmpty private final String principalName;
 
     /** Time, in milliseconds since the epoch, when this session was created. */
-    private final long creationInstant;
+    @Duration private long creationInstant;
 
     /** Last activity instant, in milliseconds since the epoch, for this session. */
-    private long lastActivityInstant;
-
+    @Duration private long lastActivityInstant;
+
+    /** An IPv4 address to which the session is bound. */
+    @Nullable private String ipV4Address;
+    
+    /** An IPv6 address to which the session is bound. */
+    @Nullable private String ipV6Address;
+        
     /** Tracks authentication results that have occurred during this session. */
-    private final ConcurrentMap<String, AuthenticationResult> authenticationResults;
+    @Nonnull @NonnullElements 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 #authenticationResults} and {@link #serviceSessions}
-     * in the same call.
-     */
-    private final Lock authnServiceStateLock;
+    @Nonnull @NonnullElements private final ConcurrentMap<String, ServiceSession> serviceSessions;
 
     /**
      * Constructor.
      * 
      * @param sessionId identifier for this session
-     * @param sessionSecret secrete for this session
-     */
-    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 cannot be null");
-        secret = new byte[sessionSecret.length];
-        System.arraycopy(sessionSecret, 0, secret, 0, sessionSecret.length);
-
+     * @param canonicalName canonical name of subject
+     */
+    public IdPSession(@Nonnull @NotEmpty final String sessionId, @Nonnull @NotEmpty final String canonicalName) {

[... 728 lines stripped ...]


More information about the commits mailing list