Package org.spincast.plugins.session
Class SpincastSessionManagerDefault
java.lang.Object
org.spincast.plugins.session.SpincastSessionManagerDefault
- All Implemented Interfaces:
SpincastSessionManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.slf4j.Loggerstatic final StringThe name of the request context variable used to save the user session. -
Constructor Summary
ConstructorsConstructorDescriptionSpincastSessionManagerDefault(SpincastSessionFactory spincastSessionFactory, com.google.inject.Provider<RequestContext<?>> requestContextProvider, JsonManager jsonManager, SpincastSessionConfig spincastSessionConfig, SpincastSessionRepository spincastSessionRepository, CookieFactory cookieFactory, SpincastConfig spincastConfig) -
Method Summary
Modifier and TypeMethodDescriptionCreates a new session.createSession(String sessionId, Instant creationDate, Instant modificationDate, JsonObject attributes) Creates a session from infos, with existing attributes if any (nullotherwise)voidDeletes the current session in the request context, if any.voiddeleteOldInactiveSession(int sessionMaxInactiveMinutes) Deletes the deletes that were inactive for too long.voiddeleteSession(String sessionId) Deletes a saved session.voidDeletes the session id on the user.Generates a new session id.protected CookieFactoryGets the session of the current user, from the request context.protected JsonManagerprotected com.google.inject.Provider<RequestContext<?>>getSavedSession(String sessionId) Gets a session from the database/data source.protected SpincastConfigprotected SpincastSessionConfigprotected SpincastSessionFactoryprotected SpincastSessionRepositoryvoidsaveSession(SpincastSession session) Save session.voidsaveSessionIdOnUser(String sessionId, boolean permanent) Will save the session id to the user (by default using a cookie).protected voidsaveSessionIdOnUser(RequestContext<?> context, String sessionId, boolean permanent) final voidSaves a session, but update its modification date first.
-
Field Details
-
logger
protected static final org.slf4j.Logger logger -
REQUEST_CONTEXT_VARIABLE_SESSION
The name of the request context variable used to save the user session.
-
-
Constructor Details
-
SpincastSessionManagerDefault
@Inject public SpincastSessionManagerDefault(SpincastSessionFactory spincastSessionFactory, com.google.inject.Provider<RequestContext<?>> requestContextProvider, JsonManager jsonManager, SpincastSessionConfig spincastSessionConfig, SpincastSessionRepository spincastSessionRepository, CookieFactory cookieFactory, SpincastConfig spincastConfig)
-
-
Method Details
-
getSpincastSessionFactory
-
getRequestContextProvider
-
getJsonManager
-
getSpincastSessionConfig
-
getSpincastSessionRepository
-
getCookieFactory
-
getSpincastConfig
-
createNewSession
Description copied from interface:SpincastSessionManagerCreates a new session.- Specified by:
createNewSessionin interfaceSpincastSessionManager
-
createSession
public SpincastSession createSession(String sessionId, Instant creationDate, Instant modificationDate, JsonObject attributes) Description copied from interface:SpincastSessionManagerCreates a session from infos, with existing attributes if any (nullotherwise)- Specified by:
createSessionin interfaceSpincastSessionManager
-
getCurrentSession
Description copied from interface:SpincastSessionManagerGets the session of the current user, from the request context. If not in a request context, returnsnull.- Specified by:
getCurrentSessionin interfaceSpincastSessionManager
-
generateNewSessionId
Description copied from interface:SpincastSessionManagerGenerates a new session id.- Specified by:
generateNewSessionIdin interfaceSpincastSessionManager
-
deleteSessionIdOnUser
public void deleteSessionIdOnUser()Description copied from interface:SpincastSessionManagerDeletes the session id on the user. By default, will delete the session id cookie.- Specified by:
deleteSessionIdOnUserin interfaceSpincastSessionManager
-
saveSessionIdOnUser
Description copied from interface:SpincastSessionManagerWill save the session id to the user (by default using a cookie).- Specified by:
saveSessionIdOnUserin interfaceSpincastSessionManagerpermanent- iftrue, the session id will be kept when the browser session expires.
-
saveSessionIdOnUser
-
updateModificationDateAndSaveSession
Description copied from interface:SpincastSessionManagerSaves a session, but update its modification date first.The session to save must have a session id.
- Specified by:
updateModificationDateAndSaveSessionin interfaceSpincastSessionManager
-
deleteCurrentSession
public void deleteCurrentSession()Description copied from interface:SpincastSessionManagerDeletes the current session in the request context, if any.- Specified by:
deleteCurrentSessionin interfaceSpincastSessionManager
-
getSavedSession
Description copied from interface:SpincastSessionManagerGets a session from the database/data source.- Specified by:
getSavedSessionin interfaceSpincastSessionManager- Returns:
- the session or
nullif not found.
-
saveSession
Description copied from interface:SpincastSessionManagerSave session.- Specified by:
saveSessionin interfaceSpincastSessionManager
-
deleteSession
Description copied from interface:SpincastSessionManagerDeletes a saved session.- Specified by:
deleteSessionin interfaceSpincastSessionManager
-
deleteOldInactiveSession
public void deleteOldInactiveSession(int sessionMaxInactiveMinutes) Description copied from interface:SpincastSessionManagerDeletes the deletes that were inactive for too long. This means their last "modification date" must be older than the specified number of mminutes.- Specified by:
deleteOldInactiveSessionin interfaceSpincastSessionManager
-