Skip to main content

Python module to add username and password authentication to specific FastAPI routes

Project description

FastAPIUIAuth

Python module to add username and password authentication to specific FastAPI routes

Python

Platform Supported

Platform

Deployments

pypi

Pypi Pypi-format Pypi-status

Installation

pip install FastAPI-UI-Auth

Usage

import uiauth

from fastapi import FastAPI
from fastapi.routing import APIRoute

app = FastAPI()

@app.get("/public")
async def public_route():
    return {"message": "This is a public route"}

async def private_route():
    return {"message": "This is a private route"}

uiauth.protect(
    app=app,
    routes=APIRoute(
        path="/private",
        endpoint=private_route
    )
)

FastAPI-UI-Auth supports both APIRoute and APIWebSocketRoute routes.
Refer samples directory for different use-cases.

Coding Standards

Docstring format: Google
Styling conventions: PEP 8 and isort

Release Notes

Requirement

python -m pip install gitverse

Usage

gitverse-release reverse -f release_notes.rst -t 'Release Notes'

Linting

Requirement

python -m pip install sphinx==5.1.1 pre-commit recommonmark

Usage

pre-commit run --all-files

Pypi Package

pypi-module

https://pypi.org/project/FastAPI-UI-Auth/

License & copyright

© Vignesh Rao

Licensed under the MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

fastapi_ui_auth-0.3.0-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_ui_auth-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: fastapi_ui_auth-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for fastapi_ui_auth-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b1617e35293de461a070e82760900149da20a270b60ecee1c84c3c058270903
MD5 4b1352d77fd0743e31f0df5eaa1002ab
BLAKE2b-256 e2a211964ea71e6d6b6d84011349226070688583ee5a770e078a2017d8743307

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