Table of Contents

Method ProvisionPasswordAsync

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

ProvisionPasswordAsync(UserId, UserCredentialUsername, ReadOnlyMemory<char>, IReadOnlyList<MailFathomPermission>?, UserCredentialReach, CancellationToken)

Provisions a username and password a user signs in with.

public Task<UserCredentialProvisioning> ProvisionPasswordAsync(UserId user, UserCredentialUsername username, ReadOnlyMemory<char> password, IReadOnlyList<MailFathomPermission>? permissions, UserCredentialReach reach, CancellationToken cancellationToken)

Parameters

user UserId

The user the credential authenticates.

username UserCredentialUsername

The canonical username it will be resolved by.

password ReadOnlyMemory<char>

The plaintext, read within this call and never retained.

permissions IReadOnlyList<MailFathomPermission>

The names the credential 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.

Exceptions

ArgumentException

Thrown when user names nobody, username is the unspecified struct default, the password breaks UserPasswordPolicy, 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.