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 JWKFetcher::getFormatted() method and switch validator to use #369

Merged
merged 2 commits into from
Sep 24, 2019

Conversation

joshcanhelp
Copy link
Contributor

Changes

  • Add JWKFetcher::getFormatted() method to pull entire JWKS instead of specific keys. This makes for more clear caching and allows us to deprecate several unnecessary methods in this class.
  • Refactor the MockApi class used in test suites to allow new mocked API responses to be added more easily.

Testing

  • This change adds test coverage
  • This change has been developed on PHP 7.1

@joshcanhelp joshcanhelp requested a review from a team September 23, 2019 20:24
@joshcanhelp joshcanhelp added this to the 5.6.0 milestone Sep 23, 2019
@joshcanhelp joshcanhelp force-pushed the add-jwks-getall-method branch from 98f0e95 to 3498808 Compare September 23, 2019 20:26
stevehobbsdev
stevehobbsdev previously approved these changes Sep 24, 2019
Copy link

@stevehobbsdev stevehobbsdev left a comment

Choose a reason for hiding this comment

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

LGTM! Just had more of a question around the getFormatted naming but didn't want to hold up the PR.

*
* @return array
*/
public function getFormatted($jwks_url)

Choose a reason for hiding this comment

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

Just a bit confused by the name. What does it mean to format the JWKS for JWT::decode()?

The naming points to an internal transform process, just wondering if the developer needs to understand that detail. Could this be called getKeysFromJwks or something similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

JWT::decode() is an external library that validates JWT signatures (and a few other things). It takes public key signatures in the form of $keys[$kid] = $x5c_pem.

Good point about the method name, that is a little vague. I don't think we need to say "from JWKS" since we're in the JWKS class but I'll rename.

@joshcanhelp joshcanhelp force-pushed the add-jwks-getall-method branch from 1c29dba to 8718eb6 Compare September 24, 2019 13:38
@stevehobbsdev stevehobbsdev self-requested a review September 24, 2019 15:39
@joshcanhelp joshcanhelp merged commit 600dd3c into master Sep 24, 2019
@joshcanhelp joshcanhelp deleted the add-jwks-getall-method branch September 24, 2019 15:40
@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants