Table of Contents

Method TryRead

Namespace
MailFathom.Infrastructure.Security.OAuth
Assembly
MailFathom.Infrastructure.dll

TryRead(string?, out string)

Reads the credential an Authorization header value carried.

public static bool TryRead(string? authorizationHeaderValue, out string credential)

Parameters

authorizationHeaderValue string

The raw header value, or null when the request carried none.

credential string

The credential when the header carried one; otherwise an empty string.

Returns

bool

true when the header carried a bearer credential; otherwise false.

Remarks

The scheme is matched ignoring case, as HTTP requires, and at least one space separates it from the credential. Anything else — another scheme, a scheme with no credential, a bare token — is malformed rather than a credential worth judging, and the caller refuses it with the same response as every other rejection.