Flask JWT consumer with multi public key support
Project description
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
defaultRS256
, algorithm used to decode JWT. As current iteration only asymmetric algorithms are considered. So anything symmetric will likely fail.JWT_HEADER_NAME
defaultAuthorization
, header where JWT expected to be.JWT_HEADER_TYPE
defaultBearer
, 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 ofaud
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
Built Distribution
Hashes for flask_jwt_consumer-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 387f58c9ff65c9d18a4c8de66363b3b67bbb53e45c378a16c9a8c770cfce945b |
|
MD5 | f79816043e848a84b4c1f0a476c560aa |
|
BLAKE2b-256 | 8de405a13118ee87ae0e6a09654c6e57c6f303c4d591adfb6d4f3f366702cb0e |