This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unfortunately Python 2.6 does not support dict comprehensions.
When using a dict object to represent an identity the default jwt_encode_callback handler fails as getattr does not work with dict objects. This change sets the default value of getattr to None so the dict get part of the statement is evaluated.
When the request is not JSON (and the `force` flag is False), Flask's `get_json()` will return None: https://github.com/mitsuhiko/flask/blob/0.10.1/flask/wrappers.py#L127 If somebody POSTs to `/auth` with a non-JSON mimetype, the server will 500 with `'NoneType' object has no attribute 'get'`. Additionally, the default second parameter to `get()` is already None - it can be safely omitted. And more than one criterion are criteria. =)
If the mimetype is indeed JSON, but strings or arrays are POSTed, an `AttributeError` will be thrown when trying to call `get()`.
Included a note about deployment to Apache/mod_wsgi gotcha.
As of 0.3.2 flask_jwt creates an endpoint named '_default_auth_request_handler', no matter what JWT_AUTH_ENDPOINT is
Fixes pallets-eco#65 See also pallets-eco#64
Closes pallets-eco#69 with proper fix
…ask-jwt into fork - .get() returns None by default
Please merge this! |
This is a great library, let's keep the progress, please merge! |
The JWT_VERIFY_CLAIMS and JWT_REQUIRED_CLAIMS assume that item precense implies each item should be verified/required, and items that are excluded, should NOT be verified or required. Unfortunately, the PyJWT library will merge the supplied list of options against a list of defaults: https://github.com/jpadilla/pyjwt/blob/1.4.0/jwt/api_jwt.py#L74-L75 This means that if a user wanted to disable verification on expiration, a user can NOT change JWT_VERIFY_CLAIMS = ['signature', 'ext', 'nbf', 'iat'] to JWT_VERIFY_CLAIMS = ['signature', 'nbf', 'iat'] If a user DOESN'T want it to verify the expiration, then they need to explicitly set `verify_exp` to `False`. The current algorithm will look at the list, see that `verify_exp` was omitted, and pass in nothing for `verify_exp` , which then makes the PyJWT assume a default (which is `verify_exp=True`) To fix, the _default_jwt_decode_handler was updated to generate an options dictionary that sets each option to `True` or `False` so JWT_VERIFY_CLAIMS = ['signature', 'nbf', 'iat'] Now will properly set `verify_ext=False`.
* jwt_error_handler was renamed error_handler * jwt_payload_handler was renamed payload_handler Rename was done in 8b6c1f5
If a ressource has a role specified the jwt should have at least this role If a list is specified, the jwt should have one (or several) of this role
The project is dead if you really want to use flask-jwt (for existing project), you can use my fork https://github.com/webstack/flask-jwt (and the public release on PyPi https://pypi.org/project/Webstack-Flask-JWT/). I don't use Flask anymore so I don't intend to maintain it. For newer projects, I recommend https://github.com/vimalloc/flask-jwt-extended |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.