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
pip install jamlibfrom 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"
)Jam is a library that provides the most popular AUTH* mechanisms right out of the box.
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, via="jwt")
if jam.authorize(principal, "user:delete"):
...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.
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 | ✅ | ❌ | ❌ | ❌ | ❌ |
