-
Notifications
You must be signed in to change notification settings - Fork 40
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 29s ⏱️ Results for commit e03278b. ♻️ 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.76% +0.18%
==========================================
Files 606 606
Lines 43733 43782 +49
Branches 48 48
==========================================
+ Hits 26494 26603 +109
+ Misses 17227 17167 -60
Partials 12 12 ☔ View full report in Codecov by Sentry. |
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]>
|
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
is located there because the refresh endpoint in #3270 needs to check if incoming tokens are active based on their claims. theis_active
function in theJWTRefreshToken
class will be used by the frontend to show if a token is active or not. By having the this function injwtgen.py
, the API and frontend can share the logic. Would be messy to have two different functions that could potentially disagree if a token is active.