-
Notifications
You must be signed in to change notification settings - Fork 41
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 model for JWT refresh token #3268
base: master
Are you sure you want to change the base?
Conversation
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
Test results 12 files 12 suites 11m 25s ⏱️ Results for commit a3db8c2. ♻️ This comment has been updated with latest results. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3268 +/- ##
==========================================
+ Coverage 60.58% 60.83% +0.25%
==========================================
Files 606 606
Lines 43733 43793 +60
Branches 48 48
==========================================
+ Hits 26494 26641 +147
+ Misses 17227 17140 -87
Partials 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f118619
to
49c7894
Compare
c87e7a1
to
50e46b4
Compare
14e45e7
to
4805ebf
Compare
4805ebf
to
63b9bc5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of NAV does not care about timezones. USE_TZ is False. Had it been True you could have used the "now" function in django.utils.timezone
. Making NAV care about time zones is yet more techdebt we need to deal with eventually, but not now.
If timezones (including utc) is important for JWTs I recommend you write something about it in the body of an actual commit so that the info is not lost.
JWT using unix timestamps for its claims isnt NAV specific, thats just how they work. But youre probably right that using timezones in the is_active function doesnt actually do anything. They should automatically be the same timezone if they're all naive, and the time delta between the timestamps and tl;dr I am fine with removing the timezones if we agree that it wont change the functionality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions and some little test name changes
Co-authored-by: Johanna England <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok, but you know me, I can't not nitpick test names :D
|
Adds a model representing a JWT refresh token. Contains a hash of the real token. Refresh tokens can then effectively be authenticated by comparing the hash to incoming token to hashes in the database.
The model contains relevant information about the token that can be displayed in the frontend.
The function
is_active
injwtgen.py
exists so the logic for whether a token is active or not can be shared between the frontend and the API. The frontend will useJWTRefreshToken.is_active
(which usesjwtgen.is_active
internally), while the API will usejwtgen.is_active
directly.