Skip to main content

Flask JWT consumer with multi public key support

Project description

CircleCI Maintainability

Flask JWT consumer

Flask extension for JWT token validation

Based on pyJWT. Supports multi public key validation in form of simplified authorized_keys format, with only keys, and comments, no options. Good for key rotations or when you need multi issuer support.

Rational

Inspired by Flask JWT Simple, nice package I was enjoying until the need for multi key support. So that's where many backward compatible settings came from.

Configuration

  • JWT_ALGORITHM default RS256, algorithm used to decode JWT. As current iteration only asymmetric algorithms are considered. So anything symmetric will likely fail.
  • JWT_HEADER_NAME default Authorization, header where JWT expected to be.
  • JWT_HEADER_TYPE default Bearer, type of the token, part of the header's value.
  • JWT_IDENTITY optional, if provided JWT will use it.
  • JWT_AUTHORIZED_KEYS new line separated list of OpenSSH formatted keys.
  • VERIFY_AUD disable verification of aud during JWT decoding.

Decorators

@requires_jwt - use on the flask endpoint that is desired to be protected, accepts additional parameter pass_token_payload which will add named parameter token_payload at the very end of the parameters accepted by decorated function.

@requires_jwt
def get(search):
    # ...GET logic with search parameter

@requires_jwt(pass_token_payload=True)
def post(data, token_payload):
    # ...POST logic with data parameter and token payload

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_jwt_consumer-1.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

flask_jwt_consumer-1.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file flask_jwt_consumer-1.1.0.tar.gz.

File metadata

  • Download URL: flask_jwt_consumer-1.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.4.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.6

File hashes

Hashes for flask_jwt_consumer-1.1.0.tar.gz
Algorithm Hash digest
SHA256 53a9f890907f764f28743c659a55615dbfa100f145299be36bd70530347c4afb
MD5 5b27f427d80d7b7d45e2ffc4962aa143
BLAKE2b-256 4ed48f492c1854327f62681a51fddc82c8acc38fd47ae3e2ecedac8f20f9f287

See more details on using hashes here.

File details

Details for the file flask_jwt_consumer-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: flask_jwt_consumer-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.4.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.6

File hashes

Hashes for flask_jwt_consumer-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2425cfaf7b512361c26e6eda8d796fac328fb8e296df5af18ff626780322ede
MD5 5d366344ac2c127213c64b0d96f0cffd
BLAKE2b-256 010389c5beb924268e2f11a6bfb4cfc07db3d29d2de3345085c071286839c93a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page