Class AuthSessionService

java.lang.Object
com.axelor.auth.AuthSessionService

public class AuthSessionService extends Object
Manages session attributes.
  • Field Details

  • Constructor Details

    • AuthSessionService

      public AuthSessionService()
  • Method Details

    • getActiveSessions

      public Collection<org.apache.shiro.session.Session> getActiveSessions()
    • getActiveSessions

      public Collection<org.apache.shiro.session.Session> getActiveSessions(User user)
      Returns all active sessions belonging to the given user.
      Parameters:
      user - the user whose sessions to retrieve
      Returns:
      collection of active sessions for the user
    • terminateSession

      public void terminateSession(String sessionId)
      Revokes the session identified by the given session ID.
      Parameters:
      sessionId - the ID of the session to revoke
    • terminateSession

      public void terminateSession(org.apache.shiro.session.Session session)
      Revokes the given Shiro session.
      Parameters:
      session - the session to revoke
    • terminateSession

      public void terminateSession(org.apache.shiro.subject.Subject subject)
      Logs out the given subject, effectively revoking its session and firing logout events.
      Parameters:
      subject - the subject to log out
    • terminateSessions

      public void terminateSessions(User user, boolean includeCurrentSession)
      Revokes all active sessions for the given user.
      Parameters:
      user - the user whose sessions to revoke
      includeCurrentSession - whether to also revoke the caller's current session
    • getSessionsData

      public List<UserSession> getSessionsData(User user)
      Returns the list of active sessions for the given user, formatted for front-end consumption.

      Each UserSession includes device info, timestamps as epoch milliseconds, and a flag indicating whether it is the caller's current session.

      Parameters:
      user - the user whose sessions to retrieve
      Returns:
      list of UserSession objects