Breaking changes 1.1.4 to 2.0.0¶
Instance¶
With the introduction of a more convenient configuration format, it was decided to move auth_type
to the config.
Old format:
from jam import Jam
jam = Jam(auth_type="jwt", config=config)
New format:
from jam import Jam
'''config.yml
jam:
auth_type: jwt
alg: HS256
secret_key: SECRET_KEY
expire: 3600
'''
jam = Jam(config="config.yml")
Configuring JWT lists¶
Previously, lists were configured by passing an instance of the jam.jwt.lists.*
class:
from jam import Jam
from jam.jwt.lists.json import JSONList
config = {
"alg": "HS256",
"secret_key": "some_key",
"expire": 3600,
"list": JSONList(type="black", json_path="blacklist.json")
}
jam = Jam(auth_type="jwt", config=config)
Now, custom settings are passed for standard redis
and json
lists. Example in dict
configuration:
from jam import Jam
config = {
"alg": "HS256",
"secret_key": "some_key",
"expire": 3600,
"list": {
"type": "black",
"backend": "redis",
"redis_uri": "redis://0.0.0.0:6379/0"
}
}
jam = Jam(config=config)
For custom lists:
from jam import Jam
config = {
"alg": "HS256",
"secret_key": "some_key",
"expire": 3600,
"list": {
"type": "black",
"backend": "custom",
"custom_module": "app.some_module.SomeModule",
"param1": "val1",
"param2": 123
}
}
jam = Jam(config=config)
Renaming ABCList
¶
It was decided to name all abstract modules Base<NAME>
, so ABCList
was renamed to BaseJWTList
.
More details: jam.jwt.list.__abc_list_repo__
Renaming __AbstractInstance
:¶
It was decided to name all abstract modules Base<NAME>
, so __AbstractInstance
was renamed to BaseJam
.
More details: jam.__abc_instances__.BaseJam
Removal of jam.utils.make_jwt_config
¶
Configuration is now done by writing config files, so a separate function is no longer needed.
Optional dependencies¶
Renamed:
* pip install jamlib[json-lists]
-> pip install jamlib[json]
* pip install jamlib[redis-lists]
-> pip install jamlib[redis]