Skip to content

Conversation

@beenje
Copy link
Contributor

@beenje beenje commented Dec 12, 2017

Setting expires_delta to timedelta(0) removes the "exp" claim
and creates a token that never expires.

Fix issue #105

Setting expires_delta to timedelta(0) removes the "exp" claim
and creates a token that never expires.

Fix issue vimalloc#105
@coveralls
Copy link

coveralls commented Dec 12, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling bfb1bc0 on beenje:master into 29b3f5a on vimalloc:master.

docs/options.rst Outdated
``JWT_REFRESH_TOKEN_EXPIRES`` How long a refresh token should live before it expires. This
takes a ``datetime.timedelta``, and defaults to 30 days
takes a ``datetime.timedelta``, and defaults to 30 days.
Can be set to ``datetime.timedelta(0)`` to disable expiration.
Copy link
Owner

Choose a reason for hiding this comment

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

I wonder if it would be more intuitive to set the expires delta to False instead of datetime.timedelta(0). I think that may be more clear about how it is used and the purpose of it, if someone looking at this out in the wild somewhere.

I think it would only need to be updated in the documentation, because the create_token methods explicitly check for if expires delta is None: https://github.com/vimalloc/flask-jwt-extended/blob/master/flask_jwt_extended/jwt_manager.py#L375

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that might be more intuitive.
JWT_ACCESS_TOKEN_EXPIRES currently must be a datetime.timedelta: https://github.com/vimalloc/flask-jwt-extended/blob/master/flask_jwt_extended/config.py#L154
So there is some code impact, but that should be minor.

This is more intuitive than timedelta(0)
@coveralls
Copy link

coveralls commented Dec 13, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 0f03c88 on beenje:master into 29b3f5a on vimalloc:master.

@coveralls
Copy link

coveralls commented Dec 13, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 413d17d on beenje:master into 29b3f5a on vimalloc:master.

@vimalloc
Copy link
Owner

This looks great. Thanks for contributing! 👍

@vimalloc vimalloc merged commit 560fbf6 into vimalloc:master Dec 14, 2017
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.

3 participants