Skip to content

Conversation

otetard
Copy link
Contributor

@otetard otetard commented Jan 2, 2019

PyJWT library implement a way to define a “leeway” for time
validations.

PyJWT also supports the leeway part of the expiration time
definition, which means you can validate a expiration time which is
in the past but not very far. For example, if you have a JWT payload
with a expiration time set to 30 seconds after creation but you know
that sometimes you will process it after 30 seconds, you can set a
leeway of 10 seconds in order to have some margin:

https://github.com/jpadilla/pyjwt/blob/master/docs/usage.rst

This is implemented as an optional configuration setting,
JWT_DECODE_LEEWAY.

@pep8speaks
Copy link

pep8speaks commented Jan 2, 2019

Hello @otetard! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on January 03, 2019 at 10:56 Hours UTC

@coveralls
Copy link

coveralls commented Jan 2, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 7617540 on otetard:feat/implement-leeway-in-jwt into c5f32c3 on vimalloc:master.

@otetard otetard force-pushed the feat/implement-leeway-in-jwt branch 5 times, most recently from ce04678 to 4ff8ce4 Compare January 2, 2019 15:58
@vimalloc
Copy link
Owner

vimalloc commented Jan 2, 2019

This commit looks good, thanks for making it! I added a few minor nit picks in the code, if you don't mind taking a look at those. Could you also add that new option to the documentation here: https://github.com/vimalloc/flask-jwt-extended/blob/master/docs/options.rst

Thanks!

@otetard otetard force-pushed the feat/implement-leeway-in-jwt branch from 4ff8ce4 to b4dd52d Compare January 3, 2019 08:12
@otetard
Copy link
Contributor Author

otetard commented Jan 3, 2019

Thanks @vimalloc for your review! I’ve updated my PR to take your comments into account.

PyJWT library implement a way to define a “leeway” for time
validations.

> PyJWT also supports the leeway part of the expiration time
> definition, which means you can validate a expiration time which is
> in the past but not very far. For example, if you have a JWT payload
> with a expiration time set to 30 seconds after creation but you know
> that sometimes you will process it after 30 seconds, you can set a
> leeway of 10 seconds in order to have some margin:
>
> https://github.com/jpadilla/pyjwt/blob/master/docs/usage.rst

This is implemented as an optional configuration setting,
`JWT_DECODE_LEEWAY`.
@otetard otetard force-pushed the feat/implement-leeway-in-jwt branch from b4dd52d to 7617540 Compare January 3, 2019 10:56
@vimalloc vimalloc merged commit be65490 into vimalloc:master Jan 3, 2019
@vimalloc
Copy link
Owner

vimalloc commented Jan 3, 2019

I released this in version 3.15.0, it should be showing up on pypi soon. Thanks for contributing! 👍

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.

5 participants