jwt
mlte/backend/api/auth/jwt.py
Handling of JWT tokens.
ALGORITHM = 'HS256'
module-attribute
Token hashing algorithm.
DEFAULT_EXPIRATION_MINS = 120
module-attribute
Default token expiration time.
EXPIRATION_CLAIM_KEY = 'exp'
module-attribute
Token claim keys.
DecodedToken
Bases: BaseModel
Model for the claims inside the token.
Source code in mlte/backend/api/auth/jwt.py
38 39 40 41 42 43 44 45 |
|
expiration_time
instance-attribute
The date and time the token expires.
username
instance-attribute
The user name.
EncodedToken
Bases: BaseModel
Model for the encoded token and additional metadata.
Source code in mlte/backend/api/auth/jwt.py
28 29 30 31 32 33 34 35 |
|
encoded_token
instance-attribute
The actual encoded token.
expires_in
instance-attribute
Lifetime in seconds of the token.
check_expired_token(token)
Checks whether the provided token has expired.
Source code in mlte/backend/api/auth/jwt.py
92 93 94 |
|
create_user_token(username, key, expires_delta=None)
Creates an access token containing a given username.
Source code in mlte/backend/api/auth/jwt.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
decode_user_token(encoded_token, key)
Decodes the provided user access token.
Source code in mlte/backend/api/auth/jwt.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|