-
Notifications
You must be signed in to change notification settings - Fork 838
Fix TypeError at /o/token/ #1597
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -897,12 +897,16 @@ def get_id_token_dictionary(self, token, token_handler, request): | |
| claims = self.get_oidc_claims(token, token_handler, request) | ||
|
|
||
| expiration_time = timezone.now() + timedelta(seconds=oauth2_settings.ID_TOKEN_EXPIRE_SECONDS) | ||
| if request.user.last_login: | ||
| auth_time = int(dateformat.format(request.user.last_login, "U")) | ||
| else: | ||
| auth_time = int(timezone.now().timestamp()) | ||
| # Required ID Token claims | ||
| claims.update( | ||
| **{ | ||
| "iss": self.get_oidc_issuer_endpoint(request), | ||
| "exp": int(dateformat.format(expiration_time, "U")), | ||
| "auth_time": int(dateformat.format(request.user.last_login, "U")), | ||
| "auth_time": auth_time, | ||
| "jti": str(uuid.uuid4()), | ||
|
Comment on lines
899
to
910
|
||
| } | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -60,6 +60,8 @@ def always_invalid_token(): | |||||
| class TestOAuth2Validator(TransactionTestCase): | ||||||
| def setUp(self): | ||||||
| self.user = UserModel.objects.create_user("user", "test@example.com", "123456") | ||||||
| self.user.last_login = None | ||||||
| self.user.save() | ||||||
|
Comment on lines
+63
to
+64
|
||||||
| self.user.last_login = None | |
| self.user.save() |
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 PR description refers to the
/o/token/endpoint, but the changelog entry records/s/auth/o/token/. This looks inconsistent and may mislead users; update the changelog entry to match the actual endpoint and wording used by the project.