Table of Contents

Method TryReadKeyId

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

TryReadKeyId(string?, out string?)

Reads the key identifier a compact-serialized JSON Web Token names for the key that signed it.

public static bool TryReadKeyId(string? credential, out string? keyId)

Parameters

credential string

The bearer credential a request presented.

keyId string

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

Returns

bool

true when a key identifier was read; otherwise false.

Remarks

What it decides is which stored public key the signature is checked against, and no more. The key it names is verified against afterwards, so a credential writing whatever it likes here picks which key refuses it — and one naming a key this deployment holds for another user is refused by that key's own signature check rather than admitted as that user.