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
Release files for authfort-service 0.0.31
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| authfort_service-0.0.31.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| authfort_service-0.0.31-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.8 kB
Release files / authfort_service-0.0.31.tar.gz
| Download URL | authfort_service-0.0.31.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
529740d4e1427a0d40419c059934e23ccbaa1877f570250aed7c229aa9ca4cea
|
|
BLAKE2b-256 checksum How to use checksums |
0a4b22048950ab6ef34bbed57dfc6cf0bb072f66110c0abb02e5c13edf49b48e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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}
|
Release files / authfort_service-0.0.31-py3-none-any.whl
| Download URL | authfort_service-0.0.31-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4a66ed2a36ac0e9754eadb8ed2680f8f588afb2a4d8d48835f46ad80c5d2e73
|
|
BLAKE2b-256 checksum How to use checksums |
cd3228bc7746fe965abc25f1dfb4db72e3bce400e5b2d67c093042839065a2fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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}
|