Table of Contents

Class UserApiKeyAuthenticationResult

Namespace
MailFathom.Infrastructure.Security.ApiKeys
Assembly
MailFathom.Infrastructure.dll

The outcome of judging one presented key against the credentials a user holds.

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

Remarks

A refused credential is an expected outcome of serving an open endpoint rather than an exceptional state, so authentication returns this instead of throwing. The successful result carries what every user-facing method establishes: the credential that matched, the user the request acts for, and what that request may do.

Properties

Admitted

Gets what the request was admitted as, or null when the credential was refused.

Rejection

Gets why the credential was refused, or null when it authenticated.

Succeeded

Gets whether the presented credential authenticated.

Methods

Authenticated(AdmittedUserCredential)

Creates a successful result naming what the request was admitted as.

Rejected(ApiKeyRejection)

Creates a refused result.