public final class SessionManager extends Object
Subjects. It will timeout those sessions regardless of any
container-provided session-timeout mechanism.
Because this is a very security-sensitive class, any public method requires the caller to
have the AllowEjbAccessPermission as any other calls to the EJB layer. This is so that the
malicious users can't trick the EJB layer into thinking that some users are logged in or log out other
users.
Also, for security reasons, this class is final so that malicious code can't subclass it and modify its behavior.
This object is a singleton.
| Modifier and Type | Method and Description |
|---|---|
static SessionManager |
getInstance()
Return the singleton object.
|
long |
getLastAccess(int sessionId) |
org.rhq.core.domain.auth.Subject |
getOverlord() |
int |
getSessionCount()
Returns the number of sessions that are currently held by this manager.
|
org.rhq.core.domain.auth.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.
|
void |
invalidate(String username)
Invalidates all sessions for the given username.
|
void |
purgeTimedOutSessions()
Asks the session manager to examine all sessions and invalidate those sessions that have timed out.
|
org.rhq.core.domain.auth.Subject |
put(org.rhq.core.domain.auth.Subject subject)
Associates a
Subject with a new session id. |
org.rhq.core.domain.auth.Subject |
put(org.rhq.core.domain.auth.Subject subject,
long timeout)
Associates a
Subject with a new session id with the given session timeout. |
public static SessionManager getInstance()
SessionManagerpublic int getSessionCount()
public org.rhq.core.domain.auth.Subject put(org.rhq.core.domain.auth.Subject subject)
Subject with a new session id. The new session will use the
default timeout.subject - public org.rhq.core.domain.auth.Subject put(org.rhq.core.domain.auth.Subject subject,
long timeout)
Subject with a new session id with the given session timeout.subject - timeout - the timeout for the session, in millisecondspublic org.rhq.core.domain.auth.Subject getSubject(int sessionId)
throws SessionNotFoundException,
SessionTimeoutException
Subject associated with the given session id.sessionId - The session idSubject associated with the session idSessionNotFoundExceptionSessionTimeoutExceptionpublic void invalidate(int sessionId)
sessionId - session id to invalidatepublic void purgeTimedOutSessions()
public void invalidate(String username)
username - username for the sessions to be invalidatedpublic long getLastAccess(int sessionId)
public org.rhq.core.domain.auth.Subject getOverlord()
Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.