Add debug info. Fix target-uri logic. Redo JWK impl#23
Merged
Conversation
leelynne
marked this pull request as ready for review
June 6, 2025 23:07
harshita-chaudhary
approved these changes
Jun 9, 2025
| return jwk, nil | ||
| } | ||
|
|
||
| // ReadJWKFromPEM converts a PEM encoded private key to JWK. Use 'fields' to set additional fields like kty, and kid. alg is set based on the passed in PrivateKey. |
Collaborator
There was a problem hiding this comment.
nit: update comment to not mention "fields".
| return FromPrivateKey(pkey) | ||
| } | ||
|
|
||
| // FromPrivateKey creates a JWK from a crypto.PrivateKey. Use 'fields' to set additional fields like kty, and kid. alg is set based on the passed in PrivateKey. |
Collaborator
There was a problem hiding this comment.
nit: same(update comment)
| Algorithm string // 'alg' | ||
| KeyID string // 'kid' | ||
| raw json.RawMessage | ||
| jtype any // the type of JWK based on KeyType. |
Collaborator
There was a problem hiding this comment.
nit: the field jtype holds the concrete value. The name sounds like it's some type only, from direct look, but I think it's okay since it's not exposed 🤔
Collaborator
Author
There was a problem hiding this comment.
That's a good call out. I'll change it. jwtImpl or something similar might be more clear.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three key changes:
Redo JWK impl - move from storing the serialized subtype to storing the golang typed subtype. This makes it easier less error prone to work with including setting values that get serialized properly.
During testing of this I found that the customer Transformer used for MetadataProvider was causing VerifyResult diffs to only partially compare since VerifyResult is assignable from MetadataProvider. Updated the compare logic to test the whole VerifyResult.
Fix target-uri logic - the code was trying to be generate the right result depending on if it was a client or server request but was wrong. It's not just always populating the value from the request URL.
Add debug info - add a per-request debug context that will return the signature base.