Interface RememberMeTokenStore

All Known Implementing Classes:
InMemoryRememberMeTokenStore

@ExperimentalJSentinelApi public interface RememberMeTokenStore
Persistent store for RememberMeTokenRecords — backs the planned "remember me" / persistent-login flow (V00.70 Phase 7).

Tokens are looked up by their hash: an auth flow receives the plain token from a client cookie, hashes it, and queries this store. The plain value never enters the store, so an attacker who exfiltrates the store cannot impersonate the subject.

Implementations must be thread-safe.

  • Method Details

    • findByHash

      Optional<RememberMeTokenRecord> findByHash(String tokenHash)
      Looks up a token record by its hash.
      Parameters:
      tokenHash - token hash; must not be null or blank
      Returns:
      the record, if present
    • save

      void save(RememberMeTokenRecord record)
      Persists or replaces the supplied token record (keyed on RememberMeTokenRecord.tokenHash()).
      Parameters:
      record - record to persist; must not be null
    • deleteByHash

      boolean deleteByHash(String tokenHash)
      Removes the record for the given hash.
      Parameters:
      tokenHash - token hash; must not be null or blank
      Returns:
      true if a record was removed, false when no such token existed
    • deleteBySubject

      int deleteBySubject(TenantId tenant, SubjectId subjectId)
      Drops every token issued to subjectId within tenant. Used by "log out everywhere" flows.
      Parameters:
      tenant - tenant scope; must not be null
      subjectId - subject; must not be null
      Returns:
      number of records removed
    • purgeExpired

      int purgeExpired(Instant now)
      Drops every token whose expiresAt is at or before now. Idempotent.
      Parameters:
      now - retention boundary; must not be null
      Returns:
      number of records purged