Table of Contents

Method TryReadDeclaredType

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

TryReadDeclaredType(string?, out string?)

Reads the media type a compact-serialized JSON Web Token declares for itself.

public static bool TryReadDeclaredType(string? credential, out string? declaredType)

Parameters

credential string

The bearer credential a request presented.

declaredType string

The unverified typ header when the credential is a JSON Web Token carrying one; otherwise null.

Returns

bool

true when a declared type was read; otherwise false.

Remarks

The header rather than the payload, because that is where RFC 7519 puts typ and RFC 8725 section 3.11 asks a deployment reading more than one kind of token to state it. What it decides here is the same thing the issuer decides and no more: which handler judges the credential. That handler then verifies the signature and compares the declared type against the one it accepts, so a credential writing whatever it likes here picks which handler refuses it.