Table of Contents

Method TryReadIssuerAndSubject

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

TryReadIssuerAndSubject(ClaimsIdentity, out string?, out string?)

Reads back the two halves an identity this type composed carries.

public static bool TryReadIssuerAndSubject(ClaimsIdentity identity, out string? issuer, out string? subject)

Parameters

identity ClaimsIdentity

The identity FromValidatedToken(IEnumerable<Claim>, string) produced.

issuer string

The authorization server that authenticated the person, when the identity names one.

subject string

That server's own identifier for them, when the identity names one.

Returns

bool

true when both halves were read.

Remarks

The joined value is what everything comparing an identity reads, and the halves are what a lookup keyed by the pair needs. Splitting it here rather than at that lookup is what keeps one place deciding how the two are joined: a caller that re-derived the subject by cutting at the separator would be reading a composition this type owns.

Exceptions

ArgumentNullException

Thrown when identity is null.