jam.jwt.lists.json
json
¶
Classes:
Name | Description |
---|---|
JSONList |
Black/White list in JSON format, not recommended for blacklists because it is not convenient to control token lifetime. |
JSONList
¶
JSONList(
type: Literal["white", "black"],
json_path: str = "whitelist.json",
)
Bases: BaseJWTList
Black/White list in JSON format, not recommended for blacklists because it is not convenient to control token lifetime.
Dependency required:
pip install jamlib[json]
Attributes:
Name | Type | Description |
---|---|---|
__list__ |
TinyDB
|
TinyDB instance |
Methods:
Name | Description |
---|---|
add |
adding token to list |
check |
check token in list |
delete |
removing token from list |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type
|
Literal['white', 'black']
|
Type of list |
required |
json_path
|
str
|
Path to .json file |
'whitelist.json'
|
add
¶
add(token: str) -> None
Method for adding token to list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token
|
str
|
Your JWT token |
required |
Returns:
Type | Description |
---|---|
None
|
(None) |
check
¶
check(token: str) -> bool
Method for checking if a token is present in list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token
|
str
|
Your jwt token |
required |
Returns:
Type | Description |
---|---|
bool
|
(bool) |
delete
¶
delete(token: str) -> None
Method for removing token from list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token
|
str
|
Your jwt token |
required |
Returns:
Type | Description |
---|---|
None
|
(None) |
FILE PATH: jam/jwt/lists/json.py