Skip to content

Conversation

@btimby
Copy link
Contributor

@btimby btimby commented Jul 31, 2020

This adds a setting to JWT middleware that allows the token expiration to be set independently of the session expiration. The token is renewed if the current time exceeds half of it's lifetime. For example, if a token expires in 8h, it will be refreshed after 4h. The session expiration now solely controls the session lifetime. The token expiration is ONLY to defend against tokens being compromised and remaining valid for eternity.

Closes #8

@btimby btimby requested a review from cabarnes July 31, 2020 19:40
@@ -1,5 +1,7 @@
from importlib import import_module

from jwt.exceptions import DecodeError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't appear to be used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I removed the exception handling but not the import. Gone.

@btimby
Copy link
Contributor Author

btimby commented Aug 3, 2020

Thanks Clif!

@btimby btimby merged commit 13bb9be into master Aug 3, 2020
@btimby btimby deleted the expires branch August 3, 2020 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change how expiration works.

3 participants