Interface SubjectSessionRegistry

All Known Implementing Classes:
InMemorySubjectSessionRegistry, StoreBackedSubjectSessionRegistry

public interface SubjectSessionRegistry
Tracks active sessions per SubjectId.

The LogoutService consults the registry to enumerate all sessions for a subject when handling LogoutScope.AllSessionsOfSubject. Each session is identified by an opaque application-defined string (a token, a Vaadin session id, a Servlet session id) so the registry stays adapter-neutral.

Implementations must be thread-safe.

  • Method Details

    • register

      void register(SubjectId subjectId, String sessionId)
      Records that sessionId belongs to subjectId. Idempotent — registering the same pair twice is a no-op.
      Parameters:
      subjectId - subject the session belongs to
      sessionId - opaque session identifier (token, session id, …)
    • unregister

      void unregister(SubjectId subjectId, String sessionId)
      Removes the (subjectId, sessionId) association if present. No-op for unknown sessions.
      Parameters:
      subjectId - subject the session belongs to
      sessionId - opaque session identifier
    • sessionsOf

      Collection<String> sessionsOf(SubjectId subjectId)
      Returns every session id currently associated with subjectId. The returned collection is a snapshot; subsequent register / unregister calls do not leak into it.
      Parameters:
      subjectId - subject to query
      Returns:
      snapshot of active session ids, possibly empty
    • clearAll

      Collection<String> clearAll(SubjectId subjectId)
      Forgets every association for subjectId. Returns the set of removed session ids so the caller can drive downstream cleanup (e.g. revoke tokens, invalidate Vaadin sessions).
      Parameters:
      subjectId - subject whose sessions to forget
      Returns:
      removed session ids