Package org.bonitasoft.engine.session
Interface SessionService
- All Known Implementing Classes:
SessionServiceImpl
public interface SessionService
- Author:
- Elias Ricken de Medeiros, Feng Hui, Matthieu Chaffotte
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidDelete all invalid sessionscreateSession(long userId, String userName, boolean technicalUser) createSession(long userId, String userName, boolean technicalUser, List<String> profiles, Set<String> permissions) createSession(String userName) Create a new session for the given user;voidDelete all sessionsvoiddeleteSession(long sessionId) Delete a session having the given idvoidDeletes all the sessions.voidDelete all sessions of a tenant except the one of the technical userlongRetrieve the default sessions's duration, in milliseconds.longgetLoggedUserFromSession(ReadSessionAccessor sessionAccessor) getSession(long sessionId) Retrieve a session by its idlongRetrieve the duration, in milliseconds, of new created session.booleanisValid(long sessionId) Verify if a session is validvoidrenewSession(long sessionId) Update the expiration and the last update dates of the session.voidsetSessionDuration(long duration) Define how long, in milliseconds, the created sessions will be valid.
-
Field Details
-
SYSTEM
name of the system user in the session- See Also:
-
SYSTEM_ID
static final long SYSTEM_IDID of the system when something is done by the system, if a user id is required, this id is given- See Also:
-
-
Method Details
-
createSession
Create a new session for the given user;- Parameters:
userName- userName- Returns:
- a new session
- Throws:
SSessionException- if some error arrives while creating the session- Since:
- 6.0
-
createSession
SSession createSession(long userId, String userName, boolean technicalUser) throws SSessionException - Throws:
SSessionException
-
createSession
SSession createSession(long userId, String userName, boolean technicalUser, List<String> profiles, Set<String> permissions) throws SSessionException - Throws:
SSessionException
-
deleteSession
Delete a session having the given id- Parameters:
sessionId- the session's id- Throws:
SSessionNotFoundException- if no session exists for the given id- Since:
- 6.0
-
cleanInvalidSessions
void cleanInvalidSessions()Delete all invalid sessions- Since:
- 6.0
-
isValid
Verify if a session is valid- Parameters:
sessionId- the session's id- Returns:
- true if the session is valid, false otherwise
- Throws:
SSessionNotFoundException- if no session exists for the given id- Since:
- 6.0
-
getSession
Retrieve a session by its id- Parameters:
sessionId- the session's id- Returns:
- the session associated to the given id
- Throws:
SSessionNotFoundException- if no session exists for the given id- Since:
- 6.0
-
getLoggedUserFromSession
- Parameters:
sessionAccessor- the sessionAccessor that contains the current session- Returns:
- the logged user or -1 if there is no session
- Since:
- 6.4
-
setSessionDuration
void setSessionDuration(long duration) Define how long, in milliseconds, the created sessions will be valid. This does not affect already created session- Parameters:
duration-- Since:
- 6.0
-
getDefaultSessionDuration
long getDefaultSessionDuration()Retrieve the default sessions's duration, in milliseconds.- Returns:
- the default sessions's duration
- Since:
- 6.0
-
getSessionDuration
long getSessionDuration()Retrieve the duration, in milliseconds, of new created session. If no duration was specified, the default duration will be used- Returns:
- the duration of new created session.
- Since:
- 6.0
-
renewSession
Update the expiration and the last update dates of the session.- Parameters:
sessionId- the session id- Throws:
SSessionException- if some error arrives while creating the session- Since:
- 6.0
-
deleteSessions
void deleteSessions()Deletes all the sessions. -
deleteAllSessions
void deleteAllSessions()Delete all sessions -
deleteSessionsExceptTechnicalUser
void deleteSessionsExceptTechnicalUser()Delete all sessions of a tenant except the one of the technical user
-