Class UserApiKeyAuthenticator
- Namespace
- MailFathom.Infrastructure.Security.ApiKeys
- Assembly
- MailFathom.Infrastructure.dll
Judges the key a request presented against the credentials this deployment holds for its users.
public sealed class UserApiKeyAuthenticator
- Inheritance
-
UserApiKeyAuthenticator
- Inherited Members
Remarks
One indexed read and no comparison loop, which is the whole difference between this and the configured-key comparison beside it. A key is reduced to its digest and the digest resolves at most one row, so what a deployment spends on a request is independent of how many credentials it holds and of where in them the presented key sits — there is no list, so there is no position to leak.
One failure path. A request carrying no credential, one that could never have been minted here, one whose digest resolves nothing, and one resolving a credential somebody disabled are all refused as CredentialUnrecognized where they are distinguishable at all, and every one of them produces the same response. What the vocabulary is for is the server log, exactly as it is for the configured keys.
Nothing written down is the credential. Neither the returned result nor anything logged on the way to it carries the presented key or its digest; what a record names is the credential's identifier, which is MailFathom's own name for the row rather than any part of what was presented.
Constructors
- UserApiKeyAuthenticator(IUserCredentialStore, IUserApiKeyMinter)
Initializes a new user API key authenticator.
Methods
- AuthenticateAsync(string?, CancellationToken)
Judges the credential an
Authorizationheader carried.