Table of Contents

Class PresentedBasicCredential

Namespace
MailFathom.Infrastructure.Security.Passwords
Assembly
MailFathom.Infrastructure.dll

The two halves of one presented Basic credential, with the password still erasable.

public sealed class PresentedBasicCredential : IDisposable
Inheritance
PresentedBasicCredential
Implements
Inherited Members

Remarks

It exists so a password read off a request has a user and a lifetime. The characters stay in the pinned buffer they were decoded into and are reached only as a span, so nothing between here and the key derivation copies them into a string the collector would keep until it felt like moving it. Disposing clears the whole buffer, and every caller disposes within the request that produced it.

The user-id is an ordinary string, because it is not a secret and is about to become a canonical username that gets indexed, logged where a credential identifier is not yet known, and written into a refusal an operator reads. What is never written anywhere is Password, which is why ToString() reports neither half: the user-id would be safe on its own, and a value that printed one half would be a value somebody eventually printed while assuming it printed neither.

Constructors

PresentedBasicCredential(string, char[], int, int)

Initializes a credential over the buffer its two halves were decoded into.

Properties

Password

Gets the password presented, for the duration of this instance.

UserId

Gets the name presented, as written and before it is folded into its canonical form.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

ToString()

Returns a string that represents the current object.