[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
Tue Sep 17 22:25:49 EDT 2013


Author: scantor
Date: Tue Sep 17 22:25:49 2013
New Revision: 4773

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4773&view=rev
Log:
Some tweaks to ServiceSession class, pending full check-in of session changes.

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/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=4773&r1=4772&r2=4773&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 Sep 17 22:25:49 2013
@@ -203,7 +203,7 @@
     public void addServiceSession(@Nonnull final ServiceSession session) {
         Constraint.isNotNull(session, "Service session can not be null");
 
-        final String serviceId = session.getServiceId();
+        final String serviceId = session.getId();
         try {
             authnServiceStateLock.lock();
             Constraint.isFalse(serviceSessions.containsKey(serviceId), "A session for service " + serviceId
@@ -232,7 +232,7 @@
     public boolean removeServiceSession(@Nonnull final ServiceSession session) {
         Constraint.isNotNull(session, "Service session can not be null");
 
-        return serviceSessions.remove(session.getServiceId(), session);
+        return serviceSessions.remove(session.getId(), session);
     }
 
     /**
@@ -251,7 +251,7 @@
             for (ServiceSession session : serviceSessions.values()) {
                 if (session.getAuthenticationEvent().equals(event)) {
                     throw new IllegalStateException("Authentication event " + event.getAuthenticationFlowId()
-                            + " is associated with the session for service " + session.getServiceId()
+                            + " is associated with the session for service " + session.getId()
                             + " and so can not be removed");
                 }
             }

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/ServiceSession.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/ServiceSession.java?rev=4773&r1=4772&r2=4773&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/ServiceSession.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/ServiceSession.java Tue Sep 17 22:25:49 2013
@@ -22,27 +22,29 @@
 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.NotEmpty;
+import net.shibboleth.utilities.java.support.annotation.constraint.Positive;
+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;
 
 /** Describes a session with a service associated with an {@link IdPSession}. */
 @ThreadSafe
-public final class ServiceSession extends BaseContext {
+public final class ServiceSession implements IdentifiableComponent {
 
     /** The unique identifier of the service. */
-    private final String serviceId;
+    @Nonnull @NotEmpty private final String serviceId;
 
     /** The time, in milliseconds since the epoch, when this session was created. */
-    private final long creationInstant;
+    @Duration @Positive private long creationInstant;
 
     /** The last activity instant, in milliseconds since the epoch, for the session. */
-    private long lastActivityInstant;
+    @Duration @Positive private long lastActivityInstant;
 
     /** The authentication event associated with this service. */
     private AuthenticationResult authenticationEvent;
@@ -54,23 +56,23 @@
      * @param event authentication event used to authenticate the principal to this service
      */
     public ServiceSession(@Nonnull @NotEmpty final String id, @Nonnull final AuthenticationResult event) {
-        serviceId = Constraint.isNotNull(StringSupport.trimOrNull(id), "Service ID can not be null nor empty");
+        serviceId = Constraint.isNotNull(StringSupport.trimOrNull(id), "Service ID cannot be null nor empty");
         creationInstant = System.currentTimeMillis();
         lastActivityInstant = creationInstant;

[... 81 lines stripped ...]


More information about the commits mailing list