Struct MailAuthenticationMechanism
- Namespace
- MailFathom.Domain.Transport
- Assembly
- MailFathom.Domain.dll
Identifies a SASL authentication mechanism a mail transport policy may permit.
[JsonConverter(typeof(MailAuthenticationMechanismJsonConverter))]
public readonly record struct MailAuthenticationMechanism : IEquatable<MailAuthenticationMechanism>
- Implements
- Inherited Members
Remarks
The type is a closed enumeration of values rather than a C# enum, because a mechanism is inseparable from its registered SASL name: configuration accepts that name, a transport adapter matches the server's advertised set against it, and the clear-text classification travels with it. Keeping the name in a separate mapping table would let the two drift apart, and a numeric member value would carry no meaning outside this assembly.
The set is closed on purpose so a policy can classify a mechanism as clear-text without interpreting server-provided text, and so it can tell a mechanism that authenticates with a password from one that authenticates with a bearer token. GSSAPI is unsupported. Being a struct, default is reachable and is not a mechanism; it is rejected where it matters, in Create(IEnumerable<MailAuthenticationMechanism>, bool, bool).
Properties
- All
Gets every supported mechanism.
- AuthenticatesWithAccessToken
Gets whether the mechanism authenticates with a short-lived access token instead of a password.
- CramMd5
Gets the mechanism that proves the password with an HMAC-MD5 challenge response.
- DigestMd5
Gets the mechanism that proves the password with a digest challenge response.
- IsSpecified
Gets whether this value names a supported mechanism rather than the unusable struct default.
- Login
Gets the mechanism that sends the user name and password in clear text as separate base64 challenges.
- Ntlm
Gets the mechanism that proves the password with the NTLM challenge-response exchange.
- OAuthBearer
Gets the registered mechanism that presents an OAuth 2.0 bearer token, as defined by RFC 7628.
- Plain
Gets the mechanism that sends the user name and password in clear text inside the SASL exchange.
- SaslName
Gets the registered SASL name used on the wire and in configuration.
- ScramSha1
Gets the mechanism that proves the password with a salted challenge response over SHA-1.
- ScramSha1Plus
Gets the SHA-1 salted challenge response bound to the TLS channel.
- ScramSha256
Gets the mechanism that proves the password with a salted challenge response over SHA-256.
- ScramSha256Plus
Gets the SHA-256 salted challenge response bound to the TLS channel.
- ScramSha512
Gets the mechanism that proves the password with a salted challenge response over SHA-512.
- ScramSha512Plus
Gets the SHA-512 salted challenge response bound to the TLS channel.
- TransmitsCredentialsInClearText
Gets whether the mechanism exposes the password to anyone able to read the channel.
- XOAuth2
Gets the mechanism that presents an OAuth 2.0 access token in Google's originally published format.
Methods
- ToString()
Returns the fully qualified type name of this instance.
- TryParseSaslName(string?, out MailAuthenticationMechanism)
Parses an operator-supplied SASL name, ignoring case and surrounding whitespace.