Package org.pac4j.core.context.session
Interface SessionStore<C extends WebContext>
-
- All Known Implementing Classes:
JEESessionStore
public interface SessionStore<C extends WebContext>
To store data in session.- Since:
- 1.8.1
- Author:
- Jerome Leleu
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<SessionStore<C>>
buildFromTrackableSession(C context, Object trackableSession)
Build a new session store from a trackable session.boolean
destroySession(C context)
Destroy the web session.Optional<Object>
get(C context, String key)
Get the object from its key in store.String
getOrCreateSessionId(C context)
Get or create the session identifier and initialize the session with it if necessary.Optional
getTrackableSession(C context)
Get the native session as a trackable object.boolean
renewSession(C context)
Renew the native session by copying all data to a new one.void
set(C context, String key, Object value)
Save an object in the store by its key.
-
-
-
Method Detail
-
getOrCreateSessionId
String getOrCreateSessionId(C context)
Get or create the session identifier and initialize the session with it if necessary.- Parameters:
context
- the web context- Returns:
- the session identifier
-
get
Optional<Object> get(C context, String key)
Get the object from its key in store.- Parameters:
context
- the web contextkey
- the key of the object- Returns:
- the optional object in store
-
set
void set(C context, String key, Object value)
Save an object in the store by its key.- Parameters:
context
- the web contextkey
- the key of the objectvalue
- the value to save in store
-
destroySession
boolean destroySession(C context)
Destroy the web session.- Parameters:
context
- the web context- Returns:
- whether the session has been destroyed
-
getTrackableSession
Optional getTrackableSession(C context)
Get the native session as a trackable object.- Parameters:
context
- the web context- Returns:
- the optional trackable object
-
buildFromTrackableSession
Optional<SessionStore<C>> buildFromTrackableSession(C context, Object trackableSession)
Build a new session store from a trackable session.- Parameters:
context
- the web contexttrackableSession
- the trackable session- Returns:
- the optional new session store
-
renewSession
boolean renewSession(C context)
Renew the native session by copying all data to a new one.- Parameters:
context
- the web context- Returns:
- whether the session store has renewed the session
-
-