Table of Contents

Method ReplaceMaterialAsync

Namespace
MailFathom.Application.Access.Credentials
Assembly
MailFathom.Application.dll

ReplaceMaterialAsync(UserId, Guid, UserCredentialMethod, UserCredentialLookup, string?, CancellationToken)

Replaces what one credential is presented as, leaving its user, its identifier, and its grant where they are.

Task<UserCredentialWriteOutcome> ReplaceMaterialAsync(UserId user, Guid credentialId, UserCredentialMethod method, UserCredentialLookup lookup, string? material, CancellationToken cancellationToken)

Parameters

user UserId

The user the credential belongs to.

credentialId Guid

The credential being written.

method UserCredentialMethod

The method the credential must already carry, so a rotation cannot land on a credential of another kind.

lookup UserCredentialLookup

The value it is resolved by from now on, which is unchanged for a password and new for a key.

material string

The stored representation of the new material, or null for a method that keeps none.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<UserCredentialWriteOutcome>

What the act did, or why it did nothing.

Remarks

One statement, so the old material is never absent and never present beside the new one: a request arriving while the replacement commits is judged against exactly one of the two, and the previous credential stops working the moment the transaction does. The instant the credential reports its material as having changed at moves with it.

Exceptions

ArgumentException

Thrown when user names nobody, credentialId is the empty identifier, or method or lookup is the unspecified struct default.