Subject-keyed index of the session ids belonging to one principal (#296).
Every other index here is keyed by sid — they answer "what does this
session own?". This one answers the inverse, "what sessions does this
subject have?", which is the question a credential change asks: the Store
has just written a new password and every session established with the old
one has to go, without the caller knowing a single sid.
UserSessionStore cannot answer it — it is create / get(sid) /
delete(sid) — so without this index revokeAllForSubject has nothing to
enumerate.
Mutability: append-only per (subject, sid), idempotent on duplicates.
Per-member removal (removeSid) is exposed because a single session ending
must not erase the subject's other sessions — unlike the sid-keyed indexes,
where the whole key dies with the session.
TTL contract: every addSid MUST be called with the session's expiresAt,
so an abandoned session ages out of the index rather than accumulating
against a long-lived user.
Subject-keyed index of the session ids belonging to one principal (#296).
Every other index here is keyed by
sid— they answer "what does this session own?". This one answers the inverse, "what sessions does this subject have?", which is the question a credential change asks: the Store has just written a new password and every session established with the old one has to go, without the caller knowing a single sid.UserSessionStorecannot answer it — it iscreate/get(sid)/delete(sid)— so without this indexrevokeAllForSubjecthas nothing to enumerate.Mutability: append-only per (subject, sid), idempotent on duplicates. Per-member removal (
removeSid) is exposed because a single session ending must not erase the subject's other sessions — unlike the sid-keyed indexes, where the whole key dies with the session.TTL contract: every
addSidMUST be called with the session'sexpiresAt, so an abandoned session ages out of the index rather than accumulating against a long-lived user.