-
Notifications
You must be signed in to change notification settings - Fork 192
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
Check expiration of token #218
base: master
Are you sure you want to change the base?
Conversation
@@ -90,6 +91,11 @@ def validate_token_request(self, request): | |||
|
|||
try: | |||
user = backend.do_auth(access_token=request.token) | |||
user_data = backend.user_data(access_token=request.token) | |||
exp = user_data['exp'] |
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.
what's the value exp holds?
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.
exp
is the expiration date of the token
Co-Authored-By: Wagner de Lima <[email protected]>
@@ -90,6 +91,11 @@ def validate_token_request(self, request): | |||
|
|||
try: | |||
user = backend.do_auth(access_token=request.token) | |||
user_data = backend.user_data(access_token=request.token) | |||
exp = user_data['exp'] | |||
if not exp and exp <= datetime.now(): |
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 not
operator having higher precedence makes this always evaluate to False whenever exp
evaluates to True. Can you please explain the desired operation here?
The current code doesn't check to see if the supplied access token is expired.
This adds a check for the
exp
field of the JWT