Table of Contents

Class ApiKeyAuthenticationResult

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

The outcome of judging one presented MCP credential against the configured API keys.

public sealed record ApiKeyAuthenticationResult : IEquatable<ApiKeyAuthenticationResult>
Inheritance
ApiKeyAuthenticationResult
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 the key's name and nothing else: that name is what an audit record and a diagnostic correlate on, and it is the only part of a key that may be written down.

Properties

AuthenticatedKeyName

Gets the name of the key that matched, 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(SecretName)

Creates a successful result naming the key that matched.

Rejected(ApiKeyRejection)

Creates a refused result.