Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions flask_jwt_extended/jwt_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ def user_claims_loader(self, callback):
access token when :func:`~flask_jwt_extended.create_access_token` is
called. By default, no extra user claims will be added to the JWT.

The callback function must be a function that takes only one argument,
*HINT*: The callback function must be a function that takes only **one** argument,
which is the object passed into
:func:`~flask_jwt_extended.create_access_token`, and returns the custom
claims you want included in the access tokens. This returned claims
must be JSON serializable.
must be *JSON serializable*.
"""
self._user_claims_callback = callback
return callback
Expand All @@ -218,11 +218,11 @@ def user_identity_loader(self, callback):
return the unmodified object that is passed in as the `identity` kwarg
to the above functions.

The callback function must be a function that takes only one argument,
*HINT*: The callback function must be a function that takes only **one** argument,
which is the object passed into
:func:`~flask_jwt_extended.create_access_token` or
:func:`~flask_jwt_extended.create_refresh_token`, and returns the
JSON serializable identity of this token.
*JSON serializable* identity of this token.
"""
self._user_identity_callback = callback
return callback
Expand All @@ -235,8 +235,8 @@ def expired_token_loader(self, callback):

{"msg": "Token has expired"}

The callback must be a function that takes zero arguments, and returns
a Flask response.
*HINT*: The callback must be a function that takes **zero** arguments, and returns
a *Flask response*.
"""
self._expired_token_callback = callback
return callback
Expand All @@ -249,9 +249,9 @@ def invalid_token_loader(self, callback):

{"msg": "<error description>"}

The callback must be a function that takes only one argument, which is
*HINT*: The callback must be a function that takes only **one** argument, which is
a string which contains the reason why a token is invalid, and returns
a Flask response.
a *Flask response*.
"""
self._invalid_token_callback = callback
return callback
Expand All @@ -264,9 +264,9 @@ def unauthorized_loader(self, callback):

{"msg": "<error description>"}

The callback must be a function that takes only one argument, which is
*HINT*: The callback must be a function that takes only **one** argument, which is
a string which contains the reason why a JWT could not be found, and
returns a Flask response.
returns a *Flask response*.
"""
self._unauthorized_callback = callback
return callback
Expand All @@ -280,8 +280,8 @@ def needs_fresh_token_loader(self, callback):

{"msg": "Fresh token required"}

The callback must be a function that takes no arguments, and returns
a Flask response.
*HINT*: The callback must be a function that takes **no** arguments, and returns
a *Flask response*.
"""
self._needs_fresh_token_callback = callback
return callback
Expand All @@ -294,8 +294,8 @@ def revoked_token_loader(self, callback):

{"msg": "Token has been revoked"}

The callback must be a function that takes no arguments, and returns
a Flask response.
*HINT*: The callback must be a function that takes **no** arguments, and returns
a *Flask response*.
"""
self._revoked_token_callback = callback
return callback
Expand All @@ -306,7 +306,7 @@ def user_loader_callback_loader(self, callback):
automatically load an object when a protected endpoint is accessed.
By default this is not used.

The callback must take one argument which is the identity JWT accessing
*HINT*: The callback must take **one** argument which is the identity JWT accessing
the protected endpoint, and it must return any object (which can then
be accessed via the :attr:`~flask_jwt_extended.current_user` LocalProxy
in the protected endpoint), or `None` in the case of a user not being
Expand All @@ -327,8 +327,8 @@ def user_loader_error_loader(self, callback):

{"msg": "Error loading the user <identity>"}

The callback must be a function that takes one argument, which is the
identity of the user who failed to load, and must return a Flask response.
*HINT*: The callback must be a function that takes **one** argument, which is the
identity of the user who failed to load, and must return a *Flask response*.
"""
self._user_loader_error_callback = callback
return callback
Expand All @@ -339,9 +339,9 @@ def token_in_blacklist_loader(self, callback):
a protected endpoint is accessed and will check if the JWT has been
been revoked. By default, this callback is not used.

The callback must be a function that takes one argument, which is the
decoded JWT (python dictionary), and returns `True` if the token
has been blacklisted (or is otherwise considered revoked), or `False`
*HINT*: The callback must be a function that takes **one** argument, which is the
decoded JWT (python dictionary), and returns *`True`* if the token
has been blacklisted (or is otherwise considered revoked), or *`False`*
otherwise.
"""
self._token_in_blacklist_callback = callback
Expand All @@ -356,9 +356,9 @@ def claims_verification_loader(self, callback):
:meth:`~flask_jwt_extended.JWTManager.claims_verification_failed_loader`
decorator.

This callback must be a function that takes one argument, which is the
custom claims (python dict) present in the JWT, and returns `True` if the
claims are valid, or `False` otherwise.
*HINT*: This callback must be a function that takes **one** argument, which is the
custom claims (python dict) present in the JWT, and returns *`True`* if the
claims are valid, or *`False`* otherwise.
"""
self._claims_verification_callback = callback
return callback
Expand All @@ -372,8 +372,8 @@ def claims_verification_failed_loader(self, callback):

{"msg": "User claims verification failed"}

This callback must be a function that takes no arguments, and returns
a Flask response.
*HINT*: This callback must be a function that takes **no** arguments, and returns
a *Flask response*.
"""
self._verify_claims_failed_callback = callback
return callback
Expand Down