-
Notifications
You must be signed in to change notification settings - Fork 31
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
Asymmetric JWT key decoding and encoding not work. #269
Comments
Hey, docs are not the strongest part of this lib yet 😄, I am still expirimenting with the API due to lack of support either from strawberry (extensions for subscriptions, and real As for Asymmetric JWT this would be great to support this built-in, I have no experience with it and currentlly in my project I didn't found a need for that so this is low-priority on my end, though PR's are allways welcomed 😄 .
As you can see from the type hints (or from the default hook) you should return
|
Yes.. I already solved the problem by defining custom JWT_PAYLOAD handler, JWT_TOKEN_FINDER and JWT_DECODE_HANDLER. The basic reason and misunderstanding in the library's code, is that you assume JWT generating string and JWT verifying string be the one same string (by default DJANGO_SECRET_KEY) To deal with asymmetric keys we should add an extra setting, and use different key to generate and verify JWT. Asymmetric keys enable single-sing-on (SSO) architecture implementation using this library. So I use strawberry-django-auth in my centralized identity provider server and generate JWT tokens using the private key. To verify tokens we should instead use a public key, that can be handed over to the other servers, so they can not generate new tokens but instead just validate existing tokens |
So jwt verifying and generating functions should be use public and private key settings by default if JWT_ALGORIHTM parameter is asymmetric
|
Solution proposal
What else
|
I like your suggestion, Hopefully by the end of the week i'll have time to get into it, feel free to submit a PR yourself. |
Description
There are multiple problems
The text was updated successfully, but these errors were encountered: