Support lookup of session by principal name or session ID
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 12 Feb 2008 09:54:39 +0000 (09:54 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 12 Feb 2008 09:54:39 +0000 (09:54 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2614 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/idp/session/impl/SessionManagerImpl.java

index a511704..daf5b91 100644 (file)
@@ -38,17 +38,17 @@ public class SessionManagerImpl implements SessionManager<Session>, ApplicationC
 
     /** Spring context used to publish login and logout events. */
     private ApplicationContext appCtx;
-    
+
     /** Number of random bits within a session ID. */
     private final int sessionIDSize = 32;
-    
+
     /** A {@link SecureRandom} PRNG to generate session IDs. */
     private final SecureRandom prng = new SecureRandom();
 
     /** Backing service used to store sessions. */
     private StorageService<String, SessionManagerEntry> sessionStore;
 
-    /** Parition in which entries are stored. */
+    /** Partition in which entries are stored. */
     private String partition;
 
     /** Lifetime, in milliseconds, of session. */
@@ -95,10 +95,11 @@ public class SessionManagerImpl implements SessionManager<Session>, ApplicationC
         byte[] sid = new byte[sessionIDSize];
         prng.nextBytes(sid);
         String sessionID = Base64.encodeBytes(sid);
-        
+
         Session session = new SessionImpl(sessionID, principal, sessionLifetime);
         SessionManagerEntry sessionEntry = new SessionManagerEntry(this, session, sessionLifetime);
-        sessionStore.put(partition, session.getSessionID(), sessionEntry);
+        sessionStore.put(partition, sessionID, sessionEntry);
+        sessionStore.put(partition, principal, sessionEntry);
         appCtx.publishEvent(new LoginEvent(session));
         return session;
     }
@@ -133,6 +134,13 @@ public class SessionManagerImpl implements SessionManager<Session>, ApplicationC
             return sessionEntry.getSession();
         }
     }
+    
+    /** {@inheritDoc} */
+    public Session getSessionByPrincipalName(String name) {
+        
+        //TODO
+        return null;
+    }
 
     /**
      * Session store entry.