Package org.apache.shiro.session.mgt
Interface SessionManager
-
- All Known Subinterfaces:
NativeSessionManager
,SecurityManager
,ValidatingSessionManager
- All Known Implementing Classes:
AbstractNativeSessionManager
,AbstractSessionManager
,AbstractValidatingSessionManager
,AuthenticatingSecurityManager
,AuthorizingSecurityManager
,CachingSecurityManager
,DefaultSecurityManager
,DefaultSessionManager
,RealmSecurityManager
,SessionsSecurityManager
public interface SessionManager
A SessionManager manages the creation, maintenance, and clean-up of all applicationSession
s.- Since:
- 0.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Session
getSession(SessionKey key)
Retrieves the session corresponding to the specified contextual data (such as a session ID if applicable), ornull
if no Session could be found.Session
start(SessionContext context)
Starts a new session based on the specified contextual initialization data, which can be used by the underlying implementation to determine how exactly to create the internal Session instance.
-
-
-
Method Detail
-
start
Session start(SessionContext context)
Starts a new session based on the specified contextual initialization data, which can be used by the underlying implementation to determine how exactly to create the internal Session instance. This method is mainly used in framework development, as the implementation will often relay the argument to an underlyingSessionFactory
which could use the context to construct the internal Session instance in a specific manner. This allows pluggableSession
creation logic by simply injecting aSessionFactory
into theSessionManager
instance.- Parameters:
context
- the contextual initialization data that can be used by the implementation or underlyingSessionFactory
when instantiating the internalSession
instance.- Returns:
- the newly created session.
- Since:
- 1.0
- See Also:
SessionFactory.createSession(SessionContext)
-
getSession
Session getSession(SessionKey key) throws SessionException
Retrieves the session corresponding to the specified contextual data (such as a session ID if applicable), ornull
if no Session could be found. If a session is found but invalid (stopped or expired), aSessionException
will be thrown.- Parameters:
key
- the Session key to use to look-up the Session- Returns:
- the
Session
instance corresponding to the given lookup key ornull
if no session could be acquired. - Throws:
SessionException
- if a session was found but it was invalid (stopped/expired).- Since:
- 1.0
-
-