Bearers
Very similar to FastAPI's OAuth2PasswordBearer, HTTPBearer and others.
Token Bearer
missil.TokenBearer
Parent class encapsulating JWT token obtaining and decoding.
Shouldn't be used as a FastAPI dependency, since the call method returns None (and is herefore declared just to avoid code checking alerts), but can be used as a parent class to create customized token procedures.
JWT token obtaining and decoding.
PARAMETER | DESCRIPTION |
---|---|
token_key |
Name of the header or http cookie key where the token bearing user permissions is stored.
TYPE:
|
secret_key |
Key used to decode the JWT token. See Python-jose docs for more details.
TYPE:
|
user_permissions_key |
Key name of the object specifying user permissions on the decoded JWT token, by default None. Example: Supposing the following decoded token claim:
TYPE:
|
algorithms |
JWT token decode algorithm, by default "HS256". See Python-jose docs for more details.
TYPE:
|
Source code in missil/bearers.py
split_token_str
get_token_from_cookies
Read the token value from http cookies.
Source code in missil/bearers.py
get_token_from_header
Get the token value from request headers.
Source code in missil/bearers.py
decode_jwt
Decode a retrieved token value and return the user permissions.
decode_from_cookies
decode_from_header
get_user_permissions
Get user permissions from a decoded token.
Source code in missil/bearers.py
Cookie Token Bearer
missil.CookieTokenBearer
Bases: TokenBearer
Read JWT token from http cookies.
JWT token obtaining and decoding.
PARAMETER | DESCRIPTION |
---|---|
token_key |
Name of the header or http cookie key where the token bearing user permissions is stored.
TYPE:
|
secret_key |
Key used to decode the JWT token. See Python-jose docs for more details.
TYPE:
|
user_permissions_key |
Key name of the object specifying user permissions on the decoded JWT token, by default None. Example: Supposing the following decoded token claim:
TYPE:
|
algorithms |
JWT token decode algorithm, by default "HS256". See Python-jose docs for more details.
TYPE:
|
Source code in missil/bearers.py
split_token_str
get_token_from_cookies
Read the token value from http cookies.
Source code in missil/bearers.py
get_token_from_header
Get the token value from request headers.
Source code in missil/bearers.py
decode_jwt
Decode a retrieved token value and return the user permissions.
decode_from_cookies
decode_from_header
get_user_permissions
Get user permissions from a decoded token.
Source code in missil/bearers.py
HTTP Token Bearer
missil.HTTPTokenBearer
Bases: TokenBearer
Read JWT token from the request header.
JWT token obtaining and decoding.
PARAMETER | DESCRIPTION |
---|---|
token_key |
Name of the header or http cookie key where the token bearing user permissions is stored.
TYPE:
|
secret_key |
Key used to decode the JWT token. See Python-jose docs for more details.
TYPE:
|
user_permissions_key |
Key name of the object specifying user permissions on the decoded JWT token, by default None. Example: Supposing the following decoded token claim:
TYPE:
|
algorithms |
JWT token decode algorithm, by default "HS256". See Python-jose docs for more details.
TYPE:
|
Source code in missil/bearers.py
split_token_str
get_token_from_cookies
Read the token value from http cookies.
Source code in missil/bearers.py
get_token_from_header
Get the token value from request headers.
Source code in missil/bearers.py
decode_jwt
Decode a retrieved token value and return the user permissions.
decode_from_cookies
decode_from_header
get_user_permissions
Get user permissions from a decoded token.
Source code in missil/bearers.py
Flexible Token Bearer
missil.FlexibleTokenBearer
Bases: TokenBearer
Tries to read the token from the cookies or from request headers.
JWT token obtaining and decoding.
PARAMETER | DESCRIPTION |
---|---|
token_key |
Name of the header or http cookie key where the token bearing user permissions is stored.
TYPE:
|
secret_key |
Key used to decode the JWT token. See Python-jose docs for more details.
TYPE:
|
user_permissions_key |
Key name of the object specifying user permissions on the decoded JWT token, by default None. Example: Supposing the following decoded token claim:
TYPE:
|
algorithms |
JWT token decode algorithm, by default "HS256". See Python-jose docs for more details.
TYPE:
|
Source code in missil/bearers.py
split_token_str
get_token_from_cookies
Read the token value from http cookies.
Source code in missil/bearers.py
get_token_from_header
Get the token value from request headers.
Source code in missil/bearers.py
decode_jwt
Decode a retrieved token value and return the user permissions.
decode_from_cookies
decode_from_header
get_user_permissions
Get user permissions from a decoded token.