Package org.bonitasoft.engine.session
Interface SessionService
-
- All Known Implementing Classes:
SessionServiceImpl
public interface SessionService- Author:
- Elias Ricken de Medeiros, Feng Hui, Matthieu Chaffotte
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcleanInvalidSessions()Delete all invalid sessionsSSessioncreateSession(long tenantId, long userId, java.lang.String userName, boolean technicalUser)SSessioncreateSession(long tenantId, long userId, java.lang.String userName, boolean technicalUser, java.util.List<java.lang.String> profiles, java.util.Set<java.lang.String> permissions)SSessioncreateSession(long tenantId, java.lang.String userName)Create a new session for the given user;voiddeleteSession(long sessionId)Delete a session having the given idvoiddeleteSessions()Deletes all the sessions.voiddeleteSessionsOfTenant(long tenantId)Delete all sessions of a tenantvoiddeleteSessionsOfTenantExceptTechnicalUser(long tenantId)Delete all sessions of a tenant except the one of the technical userlonggetDefaultSessionDuration()Retrieve the default sessions's duration, in milliseconds.longgetLoggedUserFromSession(ReadSessionAccessor sessionAccessor)SSessiongetSession(long sessionId)Retrieve a session by its idlonggetSessionDuration()Retrieve 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 Detail
-
SYSTEM
static final java.lang.String SYSTEM
name of the system user in the session- See Also:
- Constant Field Values
-
SYSTEM_ID
static final long SYSTEM_ID
ID of the system when something is done by the system, if a user id is required, this id is given- See Also:
- Constant Field Values
-
-
Method Detail
-
createSession
SSession createSession(long tenantId, java.lang.String userName) throws SSessionException
Create a new session for the given user;- Parameters:
tenantId-userName- userName- Returns:
- a new session
- Throws:
SSessionException- if some error arrives while creating the session- Since:
- 6.0
-
createSession
SSession createSession(long tenantId, long userId, java.lang.String userName, boolean technicalUser) throws SSessionException
- Throws:
SSessionException
-
createSession
SSession createSession(long tenantId, long userId, java.lang.String userName, boolean technicalUser, java.util.List<java.lang.String> profiles, java.util.Set<java.lang.String> permissions) throws SSessionException
- Throws:
SSessionException
-
deleteSession
void deleteSession(long sessionId) throws SSessionNotFoundExceptionDelete 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
boolean isValid(long sessionId) throws SSessionNotFoundExceptionVerify 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
SSession getSession(long sessionId) throws SSessionNotFoundException
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
long getLoggedUserFromSession(ReadSessionAccessor sessionAccessor)
- 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
void renewSession(long sessionId) throws SSessionExceptionUpdate 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.
-
deleteSessionsOfTenant
void deleteSessionsOfTenant(long tenantId)
Delete all sessions of a tenant- Parameters:
tenantId-
-
deleteSessionsOfTenantExceptTechnicalUser
void deleteSessionsOfTenantExceptTechnicalUser(long tenantId)
Delete all sessions of a tenant except the one of the technical user- Parameters:
tenantId-
-
-