Struct MailOAuthGrant
- Namespace
- MailFathom.Infrastructure.Mail.OAuth
- Assembly
- MailFathom.Infrastructure.dll
Identifies which OAuth 2.0 grant an account exchanges for an access token.
public readonly record struct MailOAuthGrant : IEquatable<MailOAuthGrant>
- Implements
- Inherited Members
Remarks
The value is a closed enumeration rather than a C# enum because the member is inseparable from
the grant_type string RFC 6749 puts on the wire: an operator writes that name in configuration, the token
request sends it verbatim, and a numeric member value would carry no meaning at either end.
Only the two grants a headless process can complete are members. The authorization-code grant is absent by design rather than by omission — MailFathom has no console and serves no redirect callback, so a refresh token is obtained out of band by the operator and supplied as a secret reference, exactly as a password is.
Properties
- All
Gets every supported grant.
- ClientCredentials
Gets the app-only grant that authenticates the registered application itself.
- GrantTypeName
Gets the
grant_typevalue the token request sends.
- IsSpecified
Gets whether this value names a supported grant rather than the unusable struct default.
- RefreshToken
Gets the grant that exchanges an operator-supplied refresh token for an access token.
- RequiresRefreshToken
Gets whether the grant requires the account to configure a refresh token.
Methods
- ToString()
Returns the fully qualified type name of this instance.
- TryParseGrantTypeName(string?, out MailOAuthGrant)
Parses an operator-supplied grant name, ignoring case and surrounding whitespace.