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
userUserIdThe user the subject acts for.
issuerstringThe issuer exactly as it is configured and as a token carries it.
subjectstringThe subject claim the server issues for that person.
permissionsIReadOnlyList<MailFathomPermission>The names the mapping 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.
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
usernames 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.