This release is a pre-release and may not be stable for production use.
Jam
Jam (Jam Auth Module) - Jam (Jam Auth Module) - A universal auth* framework that provides popular auth mechanisms strictly according to the specification.
- Documentation: jam.makridenko.ru
- Changelog: CHANGELOG.md
Install
pip install jamlib
Quick example
from dataclasses import dataclass
from jam import BaseSubject, Jam
@dataclass
class User(BaseSubject):
id: int
email: str
jam = Jam(config="config.toml", subject=User)
user = User(id=1, email="user@example.com")
token = jam.issue(subject=user, via="jwt")
principal = jam.authenticate(token, via="jwt")
user = principal.subject
allowed: bool = jam.authorize(
principal=principal,
permission="post:create"
)
Why Jam?
Jam is a library that provides the most popular AUTH* mechanisms right out of the box.
Authorization
Jam combines permissions granted to one credential with server-side policy rules. This makes it possible to issue two tokens for the same user with different permissions and to restrict those permissions using the current time, resource or request.
principal = jam.authenticate(token)
if jam.authorize(principal, "user:delete"):
...
Framework integrations
Jam provides ready-to-use integrations for the most popular frameworks:
Each integration offers built-in middleware or plugin support for JWT and session-based authentication.
Why choose Jam?
Jam supports many authentication methods out of the box with minimal dependencies. Here is a comparison with other libraries:
| Features / Library | Jam | Authx | PyJWT | AuthLib | OTP Auth |
|---|---|---|---|---|---|
| JOSE | ✅ | ❌ only JWT | ❌ only JWT | ✅ | ❌ |
| JWT black/white lists | ✅ | ❌ | ❌ | ❌ | ❌ |
| PASETO | ✅ | ❌ | ❌ | ❌ | ❌ |
| Server side sessions | ✅ | ✅ | ❌ | ❌ | ❌ |
| OTP | ✅ | ❌ | ❌ | ❌ | ✅ |
| OAuth2 | ✅ | ✅ | ❌ | ✅ | ❌ |
| SAML 2.0 | ✅ | ❌ | ❌ | ❌ | ❌ |
| Flexible config | ✅ | ❌ | ❌ | ❌ | ❌ |
| Modularity | ✅ | ❌ | ❌ | ❌ | ❌ |
Metadata
Release files for jamlib 4.0.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jamlib-4.0.0rc1.tar.gz | 117.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jamlib-4.0.0rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 283.7 kB
Release files / jamlib-4.0.0rc1.tar.gz
| Download URL | jamlib-4.0.0rc1.tar.gz |
|---|---|
| Size | 117.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce3f2c58643480403d4ea15d805f638c0ba3ced0f72c566618b255cc7289c2d5
|
|
BLAKE2b-256 checksum How to use checksums |
246b49639bcd8e77e704957f9d53e3383905e1e7c0a14c5011839251eae06f6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.14 {"installer":{"name":"uv","version":"0.12.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / jamlib-4.0.0rc1-py3-none-any.whl
| Download URL | jamlib-4.0.0rc1-py3-none-any.whl |
|---|---|
| Size | 165.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba6acf5e1ad169280ee066e906669dfdb888b76cff8ad17afad0868e62f897e3
|
|
BLAKE2b-256 checksum How to use checksums |
cef328752feab98216d350da4fbadf864ddf393646dc6ead62a3302f30902d34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.14 {"installer":{"name":"uv","version":"0.12.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|