Table of Contents

Class UserCredential

Namespace
MailFathom.Application.Access.Credentials
Assembly
MailFathom.Application.dll

One credential a user is admitted by, as an administrator reads it back.

public sealed record UserCredential : IEquatable<UserCredential>
Inheritance
UserCredential
Implements
Inherited Members

Remarks

There is no password here, no key, and no stored record of either, and the absence is the point: this is the whole of what the administrative surface publishes about a credential, so no answer it composes can be a way to read stored material back out of the deployment. What an operator needs is which credentials exist, whose they are, what each may do, whether they still work, and how old the material is — each of which is a fact about the record rather than about the secret.

Lookup is published for three of the four methods, which is what lets an operator tell two credentials apart without the identifier being the only handle they have: a username is what a user types, a public key's fingerprint is what that client's assertions have to name, and an issuer and subject are what an administrator wrote. A minted key's is withheld and answered as absent, for the reason LookupIsDerivedFromTheSecret gives — the digest verifies a presented key, so serving it to whoever may read a listing would be serving a verifier for material this deployment never stored.

MaterialChangedAt is carried rather than derived from the row's general update instant, because the two answer different questions the moment a credential is disabled and enabled again: an operator asking how long a password has been in use is not asking when the row was last touched. A rehash the deployment performed on a successful sign-in therefore moves Version and leaves that instant where it was.

Constructors

UserCredential(Guid, UserId, UserCredentialMethod, UserCredentialLookup, IReadOnlyList<MailFathomPermission>?, bool, long, DateTimeOffset, DateTimeOffset, OrganizationShortName)

One credential a user is admitted by, as an administrator reads it back.

Fields

MaximumListedPerUser

The most credentials one user may hold, which is therefore the most a listing returns.

Properties

CreatedAt

When the credential was provisioned.

Enabled

Whether the credential currently authenticates anything.

Id

The stable identifier every later act on this credential names.

Lookup

The value a presented credential is resolved by.

MaterialChangedAt

When what the credential is presented as was last replaced, which is the provisioning instant until it is.

Method

How the credential is presented, and therefore what Lookup holds.

Organization

The short name of the organization a password credential is scoped to, or the unspecified default where it is scoped to none — which is every credential of the other three methods.

Permissions

The names the credential narrows its user's grant to, in the published order, or null where it names none and holds what its user holds.

Reach

Gets where the credential may be presented: on which endpoints, and from which networks.

User

The user a request authenticated by this credential acts for.

Version

How many times the record has been written, counting the act that provisioned it.

Methods

HeldUnder(ScopedGrant)

Reports what a request this credential admits holds under its user's current grant.