Interface SessionStore


public interface SessionStore
Strategy interface for where Manager's own session cookies live — sibling to AuthBackend (local-DB-vs-Cognito for the *user directory*; this is in-memory-vs-Redis for *which session cookies this process currently recognizes*, an orthogonal concern). A local, single-instance Manager needs nothing beyond an in-memory map; a horizontally-scaled Manager behind a load balancer needs every instance to recognize a session created by any other instance, which an in-memory store can never do regardless of how the user directory itself is configured — see SessionManager's javadoc in cloudforge-manager for the full story.

Deliberately framework-agnostic (no Spring, no Redis client types) — implementations live in cloudforge-manager, same split as AuthBackend.

  • Method Details

    • create

      String create(String subject)
      Creates a new session for subject, returning the opaque cookie value.
    • resolveSubject

      Optional<String> resolveSubject(String sessionId)
      Resolves a session cookie to its owning subject, refreshing its TTL (sliding expiry) if still valid. Empty if the cookie is unknown or has expired.
    • invalidate

      void invalidate(String sessionId)
      Ends one session. No-op if the cookie is already unknown/expired.
    • invalidateAllForSubject

      int invalidateAllForSubject(String subject)
      Ends every session belonging to subject (admin force-logout). Returns how many were actually active and removed.
    • isLoggedIn

      boolean isLoggedIn(String subject)
      True if subject has at least one active (non-expired) session.
    • countForSubject

      int countForSubject(String subject)
      How many active sessions subject currently has.
    • activeSubjects

      Set<String> activeSubjects()
      Every subject with at least one active session right now.
    • maxAgeSeconds

      long maxAgeSeconds()
      Session TTL, in seconds — the sliding window each successful resolveSubject(String) and fresh create(String) extends.