Interface SessionService

All Known Implementing Classes:
SessionServiceImpl

public interface SessionService
Author:
Elias Ricken de Medeiros, Feng Hui, Matthieu Chaffotte
  • Field Details

    • SYSTEM

      static final String SYSTEM
      name of the system user in the session
      See Also:
    • 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:
  • Method Details

    • createSession

      SSession createSession(String userName) throws SSessionException
      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

      void deleteSession(long sessionId) throws SSessionNotFoundException
      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

      boolean isValid(long sessionId) throws SSessionNotFoundException
      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

      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 SSessionException
      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