Table of Contents

Method ProvisionOAuthSubjectAsync

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

ProvisionOAuthSubjectAsync(UserId, string?, string?, IReadOnlyList<MailFathomPermission>?, UserCredentialReach, CancellationToken)

Maps one authorization server's subject onto the user it stands for.

public Task<UserCredentialProvisioning> ProvisionOAuthSubjectAsync(UserId user, string? issuer, string? subject, IReadOnlyList<MailFathomPermission>? permissions, UserCredentialReach reach, CancellationToken cancellationToken)

Parameters

user UserId

The user the subject acts for.

issuer string

The issuer exactly as it is configured and as a token carries it.

subject string

The subject claim the server issues for that person.

permissions IReadOnlyList<MailFathomPermission>

The names the mapping narrows its user's grant to, or null to name none and hold what the user holds.

reach UserCredentialReach

On which endpoints, and from which networks, the credential may be presented.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<UserCredentialProvisioning>

What the act did, or why it did nothing.

Remarks

Where the endpoint reads a token's own scopes, they narrow what this leaves of the user's grant further. The user comes from here either way, because a token cannot carry one.

Exceptions

ArgumentException

Thrown when user names nobody, the pair cannot compose a lookup, or the grant names something a user-facing credential cannot hold.

PrincipalNotAuthorizedException

Thrown when the caller holds AdminCredentialsWrite at no scope, does not hold a name the user holds widely enough, or is not the root while the user holds a role listing a pattern.