Skip to main content

A decorator for FastAPI to verify authentication and authorization via an external service.

Project description

python-ws-microservico-modulo-verificar-autenticacao-service

This project provides a decorator for FastAPI to verify authentication and authorization via an external service.

Features

  • A FastAPI-compatible decorator for authentication and authorization.
  • Easy integration with external authentication services.
  • Customizable to fit different authentication flows.

Installation

You can install the module using pip:

pip install verifyauth

Usage

This package allows you to add an authentication layer to FastAPI endpoints via a decorator. Example usage:

from verifyauth import AuthDecorator
from fastapi import FastAPI

app = FastAPI()

auth = AuthDecorator(service_url="https://auth.example.com")

@app.get("/protected")
def verifyauth(servico, capacidade, response_tag = 'obterVipCadastroResponse2', result_tag = 'obterVipCadastroResult2'):
@verifyauth(servico='example', capacidade='test', response_tag='capacidadeServicoResponse', result_tag='capacidadeServicoResult')    
def protected_endpoint():
    return {"message": "This is a protected route"}

Build and Deployment

Build the Package

Before deploying the package to TestPyPI or PyPI, you need to build the distribution files. The build process will create both a source distribution (.tar.gz) and a wheel distribution (.whl).

To build the package, first ensure the build module is installed:

pip install build

Then, run the following command to create the distribution files:

python -m build

This will generate the distribution files in the dist/ directory.

Upload to TestPyPI

To upload the package to TestPyPI for testing purposes:

twine upload --repository-url https://test.pypi.org/legacy/ dist/*

After uploading, you can install it from TestPyPI using:

pip install --index-url https://test.pypi.org/simple/ verifyauth

Upload to PyPI

Once you've tested the package on TestPyPI and are ready to publish it, upload it to PyPI:

twine upload dist/*

You can then install it via PyPI using:

pip install verifyauth

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

verifyauth-0.1.28.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

verifyauth-0.1.28-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file verifyauth-0.1.28.tar.gz.

File metadata

  • Download URL: verifyauth-0.1.28.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for verifyauth-0.1.28.tar.gz
Algorithm Hash digest
SHA256 1280b0874f9e5bbcacae0364ab58cbe7a0c15ad25b64dee5185d04e4d693076e
MD5 377a325372112573486bb18deef6a953
BLAKE2b-256 042000b9184f923dd45d28470794896b4d8623cef96f31c65987cacde791f3ab

See more details on using hashes here.

File details

Details for the file verifyauth-0.1.28-py3-none-any.whl.

File metadata

  • Download URL: verifyauth-0.1.28-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for verifyauth-0.1.28-py3-none-any.whl
Algorithm Hash digest
SHA256 361555f1ceddffe21432a7e18b0063086e657dbf847ed8ef00c0e22718968e21
MD5 35c2b9a0065506e8b16b0f5771d205f7
BLAKE2b-256 e9988a4a098aaf518fe6410f9abf339dfd1bab24e9afeeac6f70627d3fc4937e

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