Method TryRead
- Namespace
- MailFathom.Infrastructure.Security.Passwords
- Assembly
- MailFathom.Infrastructure.dll
TryRead(string?, out PresentedBasicCredential?)
Reads the credential an Authorization header value carried.
public static bool TryRead(string? authorizationHeaderValue, out PresentedBasicCredential? credential)
Parameters
authorizationHeaderValuestringThe raw header value, or null when the request carried none.
credentialPresentedBasicCredentialThe credential when the header carried a readable one; otherwise null.
Returns
Remarks
The scheme is matched ignoring case, as HTTP requires, and at least one space separates it from the credential. A header naming another scheme, naming this one with nothing after it, carrying something that is not Base64, decoding to something that is not UTF-8, or decoding to a value with no colon in it is not a credential and is refused identically — the caller answers every one of them with the same challenge.