Method RecordAsync
- Namespace
- MailFathom.Application.Accounts
- Assembly
- MailFathom.Application.dll
RecordAsync(MailAccountId, MailboxRefreshToken, CancellationToken)
Records the refresh token for one served account, replacing whatever was stored for it before.
public Task RecordAsync(MailAccountId accountId, MailboxRefreshToken refreshToken, CancellationToken cancellationToken)
Parameters
accountIdMailAccountIdThe account the grant acts for.
refreshTokenMailboxRefreshTokenThe token to record. The caller keeps ownership of it.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task
A task that completes after durable storage.
Remarks
Recording is idempotent in the account, because re-authorizing a mailbox is what an operator does after a revocation and a second grant beside the first would leave the account holding a credential nothing chose between. The store owns that guarantee; this use case adds only the account check in front of it.
The grant is asked for first, and before the account check, so that a caller who may not write a credential cannot learn from the refusal which accounts this deployment serves.
Exceptions
- ArgumentNullException
Thrown when
refreshTokenis null.- PrincipalNotAuthorizedException
Thrown when the use case was reached by anything but a caller granted AdminCredentialsWrite.
- MailAccountNotAccessibleException
Thrown when this deployment serves no account with that identifier.