Class SessionRegistry

java.lang.Object
com.codename1.backend.security.SessionRegistry

public final class SessionRegistry extends Object

The signed-in sessions of each user, which sessionManagement().maximumSessions(n) counts, as Spring Security's SessionRegistryImpl does.

Like Spring's default, it is held in memory by one server: behind a load balancer each instance counts the sessions it served. A session is forgotten when it signs out, or once it has been idle for its timeout.

  • Constructor Details

    • SessionRegistry

      public SessionRegistry()
  • Method Details

    • getAllSessions

      public List<SessionInformation> getAllSessions(String principal, boolean includeExpiredSessions)
      Every session of principal, least recently used first, with the expired ones only when includeExpiredSessions.
    • getSessionInformation

      public SessionInformation getSessionInformation(String sessionId)
      The session with this id, or null when it is not registered.
    • registerNewSession

      public void registerNewSession(String sessionId, String principal, int maxInactiveSeconds)
      Records a sign-in of principal on the session sessionId, which times out after maxInactiveSeconds (0: never).
    • refreshLastRequest

      public void refreshLastRequest(String sessionId)
      Notes that the session served a request now.
    • removeSessionInformation

      public void removeSessionInformation(String sessionId)
      Forgets the session.