org.rhq.enterprise.server.auth
Class SessionManager

java.lang.Object
  extended by org.rhq.enterprise.server.auth.SessionManager

public class SessionManager
extends java.lang.Object

This is the JON Server's own session ID generator. It is outside any container-provided session mechanism. Its sole purpose is to provide session IDs to logged in Subjects. It will timeout those sessions regardless of any container-provided session-timeout mechanism.

This object is a singleton.


Method Summary
static SessionManager getInstance()
          Return the singleton object.
 Subject getOverlord()
           
 int getSessionIdFromUsername(java.lang.String username)
          Lookup and return the session ID that is associated with the given username.
 Subject getSubject(int sessionId)
          Returns the Subject associated with the given session id.
 void invalidate(int sessionId)
          Invalidates the session associated with the given session ID.
 int put(Subject subject)
          Associates a Subject with a new session id.
 int put(Subject subject, long timeout)
          Associates a Subject with a new session id with the given session timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SessionManager getInstance()
Return the singleton object.

Returns:
the SessionManager

put

public int put(Subject subject)
Associates a Subject with a new session id. The new session will use the default timeout.

Parameters:
subject -
Returns:
the session id assigned to the new session

put

public int put(Subject subject,
               long timeout)
Associates a Subject with a new session id with the given session timeout.

Parameters:
subject -
timeout - the timeout for the session, in milliseconds
Returns:
the session id assigned to the new session

getSessionIdFromUsername

public int getSessionIdFromUsername(java.lang.String username)
                             throws SessionNotFoundException,
                                    SessionTimeoutException
Lookup and return the session ID that is associated with the given username.

Parameters:
username - the username of the Subject that has a valid session
Returns:
session ID for the session of the give user
Throws:
SessionNotFoundException
SessionTimeoutException

getSubject

public Subject getSubject(int sessionId)
                   throws SessionNotFoundException,
                          SessionTimeoutException
Returns the Subject associated with the given session id.

Parameters:
sessionId - The session id
Returns:
the Subject associated with the session id
Throws:
SessionNotFoundException
SessionTimeoutException

invalidate

public void invalidate(int sessionId)
Invalidates the session associated with the given session ID.

Parameters:
sessionId - session id to invalidate

getOverlord

public Subject getOverlord()


Copyright © 2008-2009 Red Hat, Inc.. All Rights Reserved.