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.1
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.1.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| auth_checker-3.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.6 kB
Release files / auth_checker-3.0.1.tar.gz
| Download URL | auth_checker-3.0.1.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
342ce60047de3f0ef5f04892f05675cc7620e8970cde6bbf4e417bb343a9400d
|
|
BLAKE2b-256 checksum How to use checksums |
b523f70de1d312e6763510afc9d69d650e8b39cca50a1335f5ede26539d1bdb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / auth_checker-3.0.1-py3-none-any.whl
| Download URL | auth_checker-3.0.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
74bed5b12b6b4f6c082b28760cdb0ead3c1510ad4546a6db4c5b7f2d01734d4c
|
|
BLAKE2b-256 checksum How to use checksums |
12419736161b4d6e7c2b180098563c373fb4667d1fb0078d28a3f9439c76fbc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|