Observed since 21 Oct, 09:09 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
agios-auth-verify
FastAPI dependency that verifies a user's RBAC permission directly against the auth database
FastAPI dependency that checks an RBAC permission straight off the access-token JWT — decode the token, read the caller's permissions from its claims, allow the request only if the required permission is present. No configuration.
pip install agios-auth-verify
Requires fastapi.
from fastapi import Depends, FastAPI
from auth_verify import authorize
app = FastAPI()
@app.delete("/users/{user_id}", dependencies=[Depends(authorize("users:delete"))])
async def delete_user(user_id: str):
return {"ok": True}
The token is read from the access_token cookie or an Authorization: Bearer <token> header. The JWT payload is base64-decoded (signature not verified);
its permissions come from the permissions claim (also accepts scope /
scopes, space-delimited).
On success the dependency returns
{"success": true, "userId": ..., "email": ..., "permissionKey": ...}, so it can
also be injected as a value:
@app.delete("/users/{user_id}")
async def delete_user(user_id: str, auth=Depends(authorize("users:delete"))):
return {"ok": True, "actor": auth["userId"]}
Raises fastapi.HTTPException with body {"success": false, "message": ...}:
| Status | When |
|---|---|
401 | No token, or the token payload is unreadable |
403 | The permission is not in the token's claims |
python -m build
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
fastapiEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | fastapi>=0.100 | runtime |
bdist_wheel · 3.07 KB · Python py3
sdist · 3.41 KB · Python source
Shared repository data · GitHub
Observed since 21 Oct, 09:09 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:bd089f9a9086a5d96faf3f816cd92aa39dfcfeb6bab1411f176de83e76f9deb3