Method FromValidatedToken
- Namespace
- MailFathom.Infrastructure.Security.OAuth
- Assembly
- MailFathom.Infrastructure.dll
FromValidatedToken(IEnumerable<Claim>, string)
Maps a validated token's claims onto the minimal identity MailFathom carries.
public static ClaimsIdentity? FromValidatedToken(IEnumerable<Claim> validatedClaims, string authenticationScheme)
Parameters
validatedClaimsIEnumerable<Claim>The claims of a token whose signature, issuer, audience, and lifetime have already been checked.
authenticationSchemestringThe scheme that validated the token, which the identity records as its authentication type.
Returns
- ClaimsIdentity
The identity, or null when the token names no subject and therefore authorizes nobody.
Remarks
A token with no sub is refused rather than mapped to an anonymous identity. It is a valid token — a client
credentials grant produces one — but it names no person, and this endpoint's whole authorization story is which
person is asking. Accepting it would make "authenticated" mean two different things.
Exceptions
- ArgumentNullException
Thrown when
validatedClaimsis null.