Table of Contents

Struct UserCredentialLookup

Namespace
MailFathom.Domain.Access
Assembly
MailFathom.Domain.dll

The one value a presented credential is resolved to its user by, in the form the deployment indexes.

public readonly record struct UserCredentialLookup : IEquatable<UserCredentialLookup>
Implements
Inherited Members

Remarks

Every user-facing method resolves a user by exactly one indexed value, and this is that value whichever method produced it: a canonical username, the digest of a key this deployment minted, the fingerprint of a client's public key, or an authorization server's issuer and subject together. Modelling them as one type is what lets one table, one index, and one store contract answer all four — and what keeps the composition of the two-part OAuth value in one place rather than in the authenticator that reads it and the administration that writes it.

What the value says differs by method and is deliberately not hidden. Two of the four are readable — a username and a subject are written by whoever provisioned them — and two are digests, which is what a credential whose material may never be stored resolves by. So a listing renders this verbatim: for a key it is a fingerprint an operator can compare against what a client holds, and for a subject it is the mapping itself.

Being a struct, default is reachable and is not a lookup. It reports itself through IsSpecified, refuses to answer for a value, and is rejected by every store operation that names one.

Fields

MaximumLength

The longest lookup value the deployment stores, in characters.

Properties

IsSpecified

Gets whether this value names a lookup rather than the unusable struct default.

Value

Gets the stored form, which is what the unique index holds and a request is resolved by.

Methods

ForDigest(string)

Reads the value a minted key or a client's public key is resolved by.

ForUsername(UserCredentialUsername)

Reads the value a username credential is resolved by.

ToString()

Returns the fully qualified type name of this instance.

TryCreate(string?, out UserCredentialLookup)

Reads a stored value back into a lookup, whichever method wrote it.

TryCreateForOAuthSubject(string?, string?, out UserCredentialLookup)

Composes the value an authorization server's validated subject is resolved by.

TryReadOAuthSubject(out string?, out string?)

Reads a stored value back into the issuer and the subject it was composed from.