TokenEntry¶
-
class
gafaelfawr.token_store.
TokenEntry
(key: str, scope: str, expires: int, encoded: Optional[str] = None)¶ Bases:
object
An index entry for a user-issued token.
Users can issue and manage their own tokens. The token proper is stored as a session and the user is given a session handle to use instead of the full JWT, but we need to store some additional metadata to show the user a list of their issued tokens and let them revoke them. This class represents one token in that metadata.
Attributes Summary
encoded
The encoded form of the entry, if available. Methods Summary
from_json
(data)Deserialize a token entry from JSON. to_json
()Encode a token entry into JSON. Attributes Documentation
-
encoded
= None¶ The encoded form of the entry, if available.
This may seem odd to include, but we have to have the encoded form in order to delete a token from a Redis set.
Methods Documentation
-
classmethod
from_json
(data: str) → gafaelfawr.token_store.TokenEntry¶ Deserialize a token entry from JSON.
Parameters: data (
str
) – Encoded JSON form of a token index entry.Returns: entry – The corresponding token index entry.
Return type: Raises: json.JSONDecodeError
– The JSON is invalid.KeyError
– The JSON is missing a required field.
-