Interface IUserCredentialStore
- Namespace
- MailFathom.Application.Access.Credentials
- Assembly
- MailFathom.Application.dll
Where the credentials that resolve a request to one user are kept.
public interface IUserCredentialStore
Remarks
The credentials live in relational columns of their own rather than in a user's settings document or in an endpoint's configuration section, and this port is what states that as a contract instead of as an implementation detail. A lookup has to be resolved by an index on every authenticated request, an enabled state has to be flipped without rewriting a document, a grant has to be read beside the user it belongs to, and stored material must never sit in a value something projects, exports, or renders as configuration — none of which a JSONB record or a configuration file can promise.
One contract for all four methods, because what differs between them is what a lookup holds and what is judged against the material, neither of which is a question about where a credential is kept. A method that resolved through a port of its own would be a second table, a second index, a second ceiling, and a second administrative vocabulary for one concept.
Every write names the user beside the credential, including the ones that could have been keyed by the credential alone. That is deliberate: an administrator acts on a credential belonging to a selected user, so an identifier copied from the wrong listing answers UnknownCredential rather than rotating a credential out from under somebody else.
Nothing here takes or returns a plaintext password or a minted key. What crosses this boundary is the stored representation the method's own hasher or reader produced, which is what keeps the material's lifetime bounded to the call that made it.
Methods
- AnyRestrictedToSourceNetworksAsync(CancellationToken)
Reports whether any credential this deployment holds is restricted to source networks.
- CreateAsync(Guid, UserId, UserCredentialMethod, UserCredentialLookup, string?, IReadOnlyList<MailFathomPermission>?, UserCredentialReach, CancellationToken)
Provisions a new credential for one user.
- DeleteAsync(UserId, Guid, CancellationToken)
Removes one credential and the lookup it held.
- FindAsync(UserCredentialMethod, UserCredentialLookup, CancellationToken)
Resolves the one credential a method and a lookup name, whether or not it is enabled.
- FindPasswordAsync(UserCredentialLogin, CancellationToken)
Resolves the one password credential a login names, whether or not it is enabled.
- ReadForUserAsync(UserId, CancellationToken)
Reads the credentials one user holds, of every method.
- ReplaceMaterialAsync(UserId, Guid, UserCredentialMethod, UserCredentialLookup, string?, CancellationToken)
Replaces what one credential is presented as, leaving its user, its identifier, and its grant where they are.
- RewriteMaterialAsync(UserId, Guid, string, string, CancellationToken)
Rewrites the stored record of material that has not changed.
- SetEnabledAsync(UserId, Guid, bool, CancellationToken)
Turns one credential on or off without changing what it is presented as.