Auth Checker
A library for authorizing users based on their assigned roles, parsed from their JWT payload.
- Free software: MIT
Usage
Authorize a read operation
from auth_checker import AuthChecker
from fastapi import APIRouter, Depends
# authorize a user with "personnel:read" permissions to look up personnel
@router.get("", tags=["Personnel"], dependencies=[Depends(AuthChecker("personnel:read"))])
Authorize an update operation
from auth_checker import AuthChecker
from fastapi import APIRouter, Depends
# authorize a user with "personnel:write" permissions to disable personnel
@router.post("/disable", tags=["Personnel"], dependencies=[Depends(AuthChecker("personnel:write"))])
Model the JWT payload
TokenPayload models the claims of a decoded JWT: email, roles, inherited_roles, and permissions.
from auth_checker import TokenPayload
payload = TokenPayload(**decoded_jwt)
Metadata
Release files for auth-checker 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| auth_checker-3.0.0.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| auth_checker-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.6 kB
Release files / auth_checker-3.0.0.tar.gz
| Download URL | auth_checker-3.0.0.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
298b28c2100ac9a4ec980a252f63184f378e94731ae8d07d05c7cabda5fff11f
|
|
BLAKE2b-256 checksum How to use checksums |
ef3cd220150bc0b95be066df90a3fc9cf8810abcdaded0c64b7fadb87878e12f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / auth_checker-3.0.0-py3-none-any.whl
| Download URL | auth_checker-3.0.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28298c515159d4a6edf4e57abab6d701fc6653887b430ebe15c037d9caf3a6d0
|
|
BLAKE2b-256 checksum How to use checksums |
3f4371433d16c72d6f4fd268c876ca7827ec14468f2f9d29702b19e3bfc7f557
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|