Lightweight JWT verification for AuthFort-powered microservices
Project description
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
Project details
Release history Release notifications | RSS feed
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.28.tar.gz
(11.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file authfort_service-0.0.28.tar.gz.
File metadata
- Download URL: authfort_service-0.0.28.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.10 {"installer":{"name":"uv","version":"0.11.10","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86c9f54b044e1fcbb755a406c7550f0e6a4770a4de4cf2aaaf015788ec7438ac
|
|
| MD5 |
1bc4fe022e430d70245b21285161b47c
|
|
| BLAKE2b-256 |
34dc7ca12161b36e08607fa481c6d10bce4f3309f518545fee067397ac878c59
|
File details
Details for the file authfort_service-0.0.28-py3-none-any.whl.
File metadata
- Download URL: authfort_service-0.0.28-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.10 {"installer":{"name":"uv","version":"0.11.10","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
678ec6153331523a572b57dd9cdc4bba9eb55fa03d948a43f6e64acfa336f333
|
|
| MD5 |
97d274000559af94f7692b0eb4481cd4
|
|
| BLAKE2b-256 |
af0b20a0be76e2995a69b30af5f9703367a8acf5b74a85bc1f0c11d9599ad370
|