Skip to main content

Lightweight JWT verification for AuthFort-powered microservices

Project description

authfort-service

PyPI Python License: MIT

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.4.tar.gz (9.4 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.4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: authfort_service-0.0.4.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.4.tar.gz
Algorithm Hash digest
SHA256 c2766f47430e0fa4bcb0ab205f90b880aefdb0a1d687c20e408e94d4e30be58e
MD5 e18e618a24d141488b5fcbfff0211c45
BLAKE2b-256 a6470eca5e6c7c338987821402be861ff926d2eccba1841826a1cab800f4f67c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: authfort_service-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cbdab517e6c16961be3b19910f658e3d0ac0755c64feb884e614015664eb83a0
MD5 1b8014ebeb5312d0773150a36e1c333b
BLAKE2b-256 8e2f688a6633406912410ce909f9061485475bc2b5f87010c5a9b6d7975c0ba0

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