Method SetEnabledAsync
- Namespace
- MailFathom.Application.Access.Credentials
- Assembly
- MailFathom.Application.dll
SetEnabledAsync(UserId, Guid, bool, CancellationToken)
Turns one credential on or off while it keeps what it is presented as.
public Task<UserCredentialWriteOutcome> SetEnabledAsync(UserId user, Guid credentialId, bool enabled, CancellationToken cancellationToken)
Parameters
userUserIdThe user the credential belongs to.
credentialIdGuidThe credential being written.
enabledboolWhether it should authenticate requests.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<UserCredentialWriteOutcome>
What the act did, or why it did nothing.
Remarks
Disabling is the reversible half of revoking: the credential stops working immediately and its lookup stays claimed, so nothing else can be provisioned under the name somebody is still using.
Exceptions
- ArgumentException
Thrown when
usernames nobody orcredentialIdis the empty identifier.- 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.