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 jwksURI override option #717

Merged
merged 4 commits into from
Mar 28, 2018
Merged

Conversation

luisrudge
Copy link
Contributor

@luisrudge luisrudge commented Mar 22, 2018

ZD:37454

@luisrudge luisrudge added this to the v9.4.1 milestone Mar 22, 2018
@luisrudge luisrudge modified the milestones: v9.4.1, v9.4.2 Mar 26, 2018
Copy link
Contributor

@lbalmaceda lbalmaceda left a comment

Choose a reason for hiding this comment

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

I think it's missing 1 test case: When the __jwks_uri is not overridden you need to check that the IdTokenVerifier is going to use the issuer + default jwks path, or when this changes (breaks) on the library side you won't notice it.

__tenant: { type: 'string', message: '__tenant option is required' },
__token_issuer: { type: 'string', message: '__token_issuer option is required' }
__tenant: { optional: true, type: 'string', message: '__tenant option is required' },
__token_issuer: {
Copy link
Contributor

Choose a reason for hiding this comment

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

have you run the beautifier here? the others are one liners while this one is split in 3 lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope. I'm not testing idtoken-verifier internals here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it's the automatic code formatter

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not testing idtoken-verifier internals here.

https://github.com/auth0/auth0.js/pull/717/files/46bc569a1c1920d3f169c49ddbe2acbba9a5d165#diff-548558e7a13abfcf8869090467ec6967R2435

This looks internal to me. So if you're already doing it to check if a value gets replaced, do the same to check that a value remains as expected 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

idtoken-verifier doesn't set the url in the constructor, it builds later on. I added a test to make sure it's undefined if you don't overwrite.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then in that case both tests should ignore the idtoken-verifier implementation and test the actual outcome:

  • Have a test that succeeds to verify a token using a custom jwks_uri.
  • Have a test that succeeds to verify a token using the default jwks_uri (${id_token.iss}/.well-known/jwks.json).

Probably you can manage to feed a jwks file to the library. If you don't test this this way, how can you be sure that the __jwks_uri override is actually affecting the library verifying outcome?

Copy link
Contributor

@lbalmaceda lbalmaceda left a comment

Choose a reason for hiding this comment

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

Thanks for the new tests.

@luisrudge luisrudge merged commit d5741be into master Mar 28, 2018
@luisrudge luisrudge deleted the feature-add-jwks_uri_override branch April 24, 2018 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants