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

Allow creation of GivenKeys with a required algorithm #70

Merged
merged 1 commit into from
Nov 26, 2022

Conversation

sean-rn
Copy link
Contributor

@sean-rn sean-rn commented Nov 25, 2022

To comply with RFC 8725 Section 3.1, we allow specifying an alg for GivenKeys. It behaves equivalently to the 'alg' parameter parsed from JWKS JSON.
Resolves #69

  • I implemented it as a new function for backwards compatibility. The same sort of overload could be made for all the other constructors if desired.
  • I considered if we needed a way to specify use as well as alg but I think not. If a key's use doesn't apply, simply don't add that key.
  • I added JWKS.KeyAlg() for symmetry and convenience.
  • Unit tests cover both the happy path and the rejection of a mis-matching algorithm.

Please feel free to rename either function to better fit your conventions.

To comply with RFC 8725 Section 3.1, we allow specifying an alg for GivenKeys.
It behaves equivalently to the 'alg' parameter parsed from JWKS JSON.
@MicahParks
Copy link
Owner

Thank you! I will likely review this tomorrow.

@MicahParks
Copy link
Owner

Thank you for noticing the PR and gap in implementation, @sean-rn! I'll merge this now and do a release later after a few edits. The next release may be sometime today.

@MicahParks MicahParks merged commit d327d9a into MicahParks:master Nov 26, 2022
@sean-rn sean-rn deleted the given-key-alg branch November 26, 2022 17:55
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.

There is no way to specify a required algorithm for Given Keys
2 participants