Skip to content

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

Notifications You must be signed in to change notification settings

fernaper/fastapi-oauth-rbac

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •