-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
adding RS256 support to JWT plugin #1053
Conversation
This is very nice, I just gave it a try locally. Thank you fro the feature + the fix! |
Thank you! Hopefully others will find this useful as well. |
@kdstew can you please fix the conflict errors? Happy to go ahead and merge this. |
@thefosk I've rebased with |
adds `algorithm` specification on the credential, defaults to `HS256`
@thefosk @thibaultcha would you mind looking at the failing tests here? I made a fix to address the migrations being run when the tables already existed. However I'm not sure why this test run failed. |
Hey, Would you please remove your last commit? It's actually not needed (the schema is already dropped before and after). Dropping the schema is not even necessary actually. The tests are just not as reliable as they should be. I tested your changes on my end and they were fine. Will merge when I get a chance to.
|
Sounds good. That last commit has been removed. |
Thanks, I just merged this in |
Just spotted a flaw here: since I just opened #1090 to fix that (which was originally only to add integration tests). |
Our use case has added the need for being able to use
RS256
signed tokens, so we took a stab at adding this functionality to the JWT plugin.The following are the changes included in this PR:
algorithm
specification on the credential, defaults toHS256
The reason for adding the algorithm check is to address the vulnerability described here that is introduced by supporting both HS256 and RS256 signed tokens.
Steps to test
Generate private and public keys:
Enable jwt plugin on an api
Create a consumer
Base64 encode public key
Add jwt credential to consumer
Create a JWT and sign with private key
key
value to the value of theiss
field in the payloadMake a request with the generated token!