Skip to main content

Lightweight JWT verification for AuthFort-powered microservices

Project description

AuthFort

authfort-service

PyPI Coverage Python License: MIT Docs

Lightweight JWT verification for microservices powered by AuthFort.

Install

pip install authfort-service[fastapi]

Quick Start

from authfort_service import ServiceAuth
from fastapi import FastAPI, Depends

service = ServiceAuth(
    jwks_url="https://auth.example.com/.well-known/jwks.json",
    issuer="authfort",
)

app = FastAPI()

@app.get("/api/data")
async def protected(user=Depends(service.current_user)):
    return {"user_id": user.sub, "roles": user.roles}

@app.get("/api/admin")
async def admin_only(user=Depends(service.require_role("admin"))):
    return {"message": "admin access"}

Features

  • JWKS fetching with automatic caching and refresh
  • JWT signature verification (RS256)
  • Token introspection client (optional real-time validation)
  • FastAPI integration (current_user, require_role dependencies)
  • No database required

With Introspection

service = ServiceAuth(
    jwks_url="https://auth.example.com/.well-known/jwks.json",
    issuer="authfort",
    introspect_url="https://auth.example.com/auth/introspect",
    introspect_secret="shared-secret",
)

# Real-time validation (checks ban status, token version, fresh roles)
result = await service.introspect(token)

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

authfort_service-0.0.27.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

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

authfort_service-0.0.27-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file authfort_service-0.0.27.tar.gz.

File metadata

  • Download URL: authfort_service-0.0.27.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for authfort_service-0.0.27.tar.gz
Algorithm Hash digest
SHA256 ed681bce4075245d480fde483db56252e9045de6aa673cb076d45f0f3f7eb5a5
MD5 c3738c6a19e83c2ad2b67498eb225d09
BLAKE2b-256 1966477372f396414e2a1fe3b2ad8f1cb9296d63e41b4d3558b51432afa26876

See more details on using hashes here.

File details

Details for the file authfort_service-0.0.27-py3-none-any.whl.

File metadata

  • Download URL: authfort_service-0.0.27-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for authfort_service-0.0.27-py3-none-any.whl
Algorithm Hash digest
SHA256 4fcfc77ef99a6c4bd1b58c4a4e77ebee9e8bfb026dd91d73693f453184d3cb30
MD5 b8d5d30bd591e97304fc9d14d99f1c00
BLAKE2b-256 a69afd789597b7b0515ce5df5188843172ccf7e0f8f70fa29e4fc9f9bab286ca

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