Skip to main content

A comprehensive FastAPI library for Authentication and NIST-style Role-Based Access Control (RBAC) with SQLAlchemy support.

Project description

FastAPIOAuthRBAC

PyPI version Downloads Downloads Month

A comprehensive FastAPI library for Authentication and NIST-style Role-Based Access Control (RBAC).


📖 Complete Documentation

The documentation has been significantly improved and split into easy-to-digest resources:


🛠️ Examples

Check out the examples/ directory for practical implementations:

  • basic_app.py: Standard implementation.
  • multi_tenancy.py: [NEW] Scoping users and roles to tenants.
  • advanced_extension.py: [NEW] Custom User models, Hooks, and Email services.
  • testing_example.py: [NEW] How to test your protected routes.

Quick Start (Minimal)

from fastapi import FastAPI
from fastapi_oauth_rbac import FastAPIOAuthRBAC

app = FastAPI()

# Initialize with default settings or your own Settings object
auth = FastAPIOAuthRBAC(app)

# Explicitly include the routes you want
auth.include_auth_router()
auth.include_dashboard()

📦 Installation Extras

# For PostgreSQL support
pip install "fastapi-oauth-rbac[postgres]"

# For SQLite support (async)
pip install "fastapi-oauth-rbac[sqlite]"

Features

  • Asynchronous: Full support for aiosqlite, asyncpg, etc.
  • NIST RBAC: Advanced Role-Based Access Control with hierarchy.
  • Full Auth Flow: Login, Signup, OAuth (Google), and Global Logout.
  • Premium Dashboard: Manage users and roles through a beautiful glassmorphism UI.

License

MIT

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

fastapi_oauth_rbac-0.2.0.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_oauth_rbac-0.2.0-py3-none-any.whl (42.4 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_oauth_rbac-0.2.0.tar.gz.

File metadata

  • Download URL: fastapi_oauth_rbac-0.2.0.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.2

File hashes

Hashes for fastapi_oauth_rbac-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6d29b459eed5831c0998d242b2631b9530ef405c46d3ab12c97376fdd427318c
MD5 39afe2be35be9f36680e2fd009c831c8
BLAKE2b-256 ab9264ce4296a69906ea0b1fc4c397c46c94f595c554ec5e25a2303dd196ac0d

See more details on using hashes here.

File details

Details for the file fastapi_oauth_rbac-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_oauth_rbac-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51cd24a335d0db2b3cf8b52839e9ebbf76092d7606dcbcad3ea28e6a8c1b78d9
MD5 ae6dc8103f453089cc2a853eca3ba106
BLAKE2b-256 922cf0438e9bef42fcb95126a8ad2d6bb5a1cf0ab3e96e2f7f0c0e3f79c32478

See more details on using hashes here.

Supported by

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