Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JKT unprotected header to PK token #73

Merged
merged 2 commits into from
Dec 11, 2023
Merged

Conversation

kipz
Copy link
Contributor

@kipz kipz commented Dec 8, 2023

As per OIDC spec, kid isn't always present in ID tokens, and if present, is only guaranteed to be unique within a given key set.

Verifiers need to be able to look Op public keys in reliable way.

This PR adds a thumbprint calculated in line with RFC-7638 JSON Web Key (JWK) Thumbprint and adds it as an unprotected header called jkt to the Op Signature in the JSON serialization of the PK Token using a new method PKToken.AddJKTHeader

After review:

  • Moved baseUrl encoder to Strict mode
  • Added a thumbprint test

Resolves #61

@EthanHeilman EthanHeilman self-requested a review December 8, 2023 17:55
Copy link
Member

@mrjoelkamp mrjoelkamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@jonnystoten jonnystoten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks for adding those missing error checks!

pktoken/pktoken.go Outdated Show resolved Hide resolved
@jonnystoten jonnystoten merged commit b939cc5 into openpubkey:main Dec 11, 2023
3 checks passed
@EthanHeilman EthanHeilman mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How do we deal with missing/non-unique kid on JWKS endpoint?
4 participants