Contains the AuthChecker class for apps using the Auth Service
Project description
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"))])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
auth_checker-1.1.1.tar.gz
(9.6 kB
view hashes)
Built Distribution
Close
Hashes for auth_checker-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d0b3a60e18fef9c7afbf95e7185a5379d725993ab54b4e61cccb90e1442cdb7 |
|
MD5 | b59fb2bed9e3642357771f3e4f538454 |
|
BLAKE2b-256 | 7a15effe3ac8b6eaf83cd0f92fab37fc685bc860b85a78e1b24050f1af3e0c66 |