JWT/OIDC + multi-tenant scoping helpers for CerebrixOS services
Project description
cerebrixos_auth
Auth helpers for CerebrixOS-style multi-tenant systems.
Install
pip install cerebrixos_auth
Environment variables
Required:
- CEREBRIX_ENV=test|prod
- OIDC_ISSUER
- OIDC_AUDIENCE
- WEBHOOK_HMAC_SECRET
- DOWNLOAD_SIGNING_KEY
Test-only:
- TEST_JWT_SECRET (required when CEREBRIX_ENV=test)
Optional:
- FILE_URL_TTL_SECONDS (default 900)
- JWKS_CACHE_TTL_SECONDS (default 3600)
- JWKS_TIMEOUT_SECONDS (default 5)
Quick usage (FastAPI)
from fastapi import FastAPI, Request
from cerebrixos_auth import load_config_from_env, verify_bearer_jwt, tenant_user_from_payload
app = FastAPI()
cfg = load_config_from_env()
@app.get("/secure")
def secure(req: Request):
payload = verify_bearer_jwt(req.headers.get("authorization"), cfg)
tenant_id, user_id = tenant_user_from_payload(payload)
return {"tenant_id": tenant_id, "user_id": user_id}
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
cerebrixos_auth-0.1.1.tar.gz
(8.3 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 cerebrixos_auth-0.1.1.tar.gz.
File metadata
- Download URL: cerebrixos_auth-0.1.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0585c7cc002a5b351cb999db9ef82cb0cdf12c0f8593d24ebbbd77458e9baf6c
|
|
| MD5 |
4f8f7a9cd97a5210484210593fa09a04
|
|
| BLAKE2b-256 |
62345d6901b7f3627211f2a27ffe089fadbd753dd2583eadb60526684ca71f92
|
File details
Details for the file cerebrixos_auth-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cerebrixos_auth-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7818ee22c822e430f18a58d2787eb301d9ece6c6c927e94cfa9d52041927be1a
|
|
| MD5 |
9a8cf71737dae154c9a519dd43b7f715
|
|
| BLAKE2b-256 |
c18d00ead8fb1b47225cbb09e927758e8806c593b98e1156555130ba8a19536a
|