Interface IClientSessionStore
- Namespace
- MailFathom.Application.Access.Sessions
- Assembly
- MailFathom.Application.dll
Where the deployment holds the sessions its clients signed in with, so every replica accepts one and every replica honours its revocation.
public interface IClientSessionStore
Remarks
The port exists because the property it carries is the deployment's rather than a process's. A session held by the
replica that minted it is a session roughly (N−1)/N of a client's requests are refused by, which the client
meets as being signed out; and an operator ending somebody's access would end it on the one replica their
administrative request happened to reach.
ADR 0033
records both halves of that, and why nothing caches what this answers.
Two acts are absent from it deliberately. Ending every session of a credential an operator disabled is not a call on this port: it commits with the disable itself, so no exchange can write a session between the two. Ending every session of a deleted credential or an erased user is not one either: the rows reference both, cascading, so an erasure reaches a session through the user directly even where no credential stands behind it.
What reaches an implementation is an identifier and a digest, never a presented token: the shape of a value a caller wrote is judged before any statement runs, and what is stored is a digest, so a row read out of the database, a dump, or a backup is not a session.
Methods
- FindAsync(string, CancellationToken)
Reports what the deployment holds under one identifier, without judging it.
- RemoveExpiredAsync(DateTimeOffset, CancellationToken)
Removes the sessions that can no longer authenticate anything.
- RenewAsync(string, ReadOnlyMemory<byte>, MintedClientSessionRow, DateTimeOffset, CancellationToken)
Replaces a live session with a new one, carrying its grant forward, so one sign-in holds one live token however often a client renews.
- RevokeAsync(string, ReadOnlyMemory<byte>, CancellationToken)
Ends one session, so the token it was signed in with is refused on the next request rather than at its expiry.
- TryMintAsync(MintedClientSessionRow, ClientSessionGrant, int, CancellationToken)
Holds a new session for what a credential admitted, while the user and the credential behind it still admit one and the deployment is under its own bound.