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
userUserIdThe user the credential authenticates.
usernameUserCredentialUsernameThe canonical username it will be resolved by.
passwordReadOnlyMemory<char>The plaintext, read within this call and never retained.
permissionsIReadOnlyList<MailFathomPermission>The names the credential narrows its user's grant to, or null to name none and hold what the user holds.
reachUserCredentialReachOn which endpoints, and from which networks, the credential may be presented.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<UserCredentialProvisioning>
What the act did, or why it did nothing.
Exceptions
- ArgumentException
Thrown when
usernames nobody,usernameis 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.