jwt
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
34 35 36 37 38 39 40 41 | |
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
24 25 26 27 28 29 30 31 | |
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
88 89 90 | |
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
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
decode_user_token(encoded_token, key)
Decodes the provided user access token.
Source code in mlte/backend/api/auth/jwt.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |