Skip to main content

Contains the AuthChecker class for apps using the Auth Service

Project description

Auth Checker

Release Status

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


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)

Uploaded Source

Built Distribution

auth_checker-1.1.1-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page