Table of Contents

Class MailboxRefreshTokenRecorder

Namespace
MailFathom.Application.Accounts
Assembly
MailFathom.Application.dll

Takes the refresh token an operator authorized for one mailbox and stores it against that account.

public sealed class MailboxRefreshTokenRecorder
Inheritance
MailboxRefreshTokenRecorder
Inherited Members

Remarks

This is the use case behind the administrative write route, and the only path by which a grant enters the store from outside a token request. It exists as a use case rather than as endpoint code for the reason the account check exists at all: what a grant may be written for is a rule about this deployment's accounts, not about HTTP.

The token is checked against the served accounts before anything is written. A grant stored for an account no configuration names is a credential for a named mailbox owner that nothing will ever read and nobody knows is there, so it is refused rather than kept — which is also what turns a mistyped account identifier into a failure at the terminal rather than into an account that silently keeps failing to authenticate.

The caller keeps ownership of the token, as SaveTokenAsync(MailAccountId, MailboxRefreshToken, CancellationToken) requires, and nothing here copies it into a value with a longer life than the request.

Constructors

MailboxRefreshTokenRecorder(IMailAccountCatalog, IMailboxRefreshTokenStore)

Initializes the use case over the accounts this deployment serves and the store that seals a token.

Methods

RecordAsync(MailAccountId, MailboxRefreshToken, CancellationToken)

Records the refresh token for one served account, replacing whatever was stored for it before.