ASGI middleware for Caracal mandate verification (FastAPI, Starlette, Quart)
Project description
caracalai-asgi
ASGI middleware for Caracal mandate verification. Protects FastAPI, Starlette, Quart, and any other ASGI application with fail-closed verification of Caracal-issued mandates.
Part of Caracal: a security-first authority and delegation system for AI agents.
Install
pip install caracalai-asgi
Use
from caracalai_asgi import CaracalASGIAuth
from caracalai_revocation import InMemoryRevocationStore
from fastapi import FastAPI
app = FastAPI()
app.add_middleware(
CaracalASGIAuth,
audience="resource://billing-api",
revocations=InMemoryRevocationStore(),
routes={"/payouts": {"required_scopes": ["billing:payout"], "require_delegation": True}},
exclude=["/healthz"],
)
The issuer defaults to CARACAL_STS_URL and the zone to CARACAL_ZONE_ID. Verified claims are available as request.state.caracal.
Links
- Source: https://github.com/Garudex-Labs/caracal
- Docs: https://caracal.run/guides/protect-fastapi/
- License: Apache-2.0
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
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 caracalai_asgi-0.1.6rc2.tar.gz.
File metadata
- Download URL: caracalai_asgi-0.1.6rc2.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2361c64ee9631da75f9df16d8ff56d3fd6d3aff91dcec84644663400134e55a2
|
|
| MD5 |
f6d9b1725c700ad41a088a8e38b9037e
|
|
| BLAKE2b-256 |
18454247690ea9e394a9b100575f420e97dede2351b5fe5cb1bf0c29c76c73ea
|
File details
Details for the file caracalai_asgi-0.1.6rc2-py3-none-any.whl.
File metadata
- Download URL: caracalai_asgi-0.1.6rc2-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f0003d46eef85afdf55d4da22dec18b970384dc8b58a24226b94395f3cab299
|
|
| MD5 |
3237e63acc274b6a65c68cb1ac17c8fe
|
|
| BLAKE2b-256 |
95d466da8ea6e6fc7aedcae183159c515ee83fddca297e35618765846277104d
|