File: custom_decorators.rst

package info (click to toggle)
python-flask-jwt-extended 4.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 592 kB
  • sloc: python: 4,279; makefile: 193; sh: 6
file content (14 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Custom Decorators
=================

You can create your own decorators that extend the functionality of the
decorators provided by this extension. For example, you may want to create
your own decorator that verifies a JWT is present as well as verifying that
the current user is an administrator.

:func:`flask_jwt_extended.verify_jwt_in_request` can be used to build your own decorators.
This is the same function used by :func:`flask_jwt_extended.jwt_required`.

Here is an example of how this might look.

.. literalinclude:: ../examples/custom_decorators.py