Table of Contents

Method TryCreate

Namespace
MailFathom.Domain.Access
Assembly
MailFathom.Domain.dll

TryCreate(string?, out UserCredentialUsername)

Reads a written username into its canonical form.

[SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "The canonical form is lowercase because it is what an operator types and what the unique index holds; it is never used for a security decision on its own.")]
public static bool TryCreate(string? written, out UserCredentialUsername username)

Parameters

written string

The name as a person or an operator typed it, or null when none was supplied.

username UserCredentialUsername

The canonical username when the written form is usable; otherwise the unspecified default.

Returns

bool

true when the written form is a username this deployment accepts.

Remarks

It answers rather than raising because both of its callers meet an unusable value as an ordinary event: a request presenting a malformed credential, which is refused like every other refused credential, and an operator provisioning one, which is answered with what to write instead.