Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /session_based_access_control /fief-dev_fief.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Subject", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "The admin dashboard is server-rendered (Jinja/htmx); the admin session cookie (settings.fief_admin_session_cookie_name) is sent automatically by the user's browser, which is outside the repo. No in-repo client code sends the session id to get_admin_session_token (fief/dependencies/admin_session.py:29)." | |
| }, | |
| { | |
| "role": "Authentication enforcer", | |
| "status": "present", | |
| "symbol": "get_admin_session_token", | |
| "file": "fief/dependencies/admin_session.py", | |
| "lines": "29", | |
| "notes": "FastAPI dependency pulled in by is_authenticated_admin_session (fief/dependencies/admin_authentication.py:16), which every dashboard router installs (e.g. fief/apps/dashboard/routers/users.py:81). It reads the admin session cookie via APIKeyCookie (admin_session.py:11) and redirects to the dashboard login (307) when no open session is resolved, otherwise passes the AdminSessionToken on." | |
| }, | |
| { | |
| "role": "Verifier", | |
| "status": "present", | |
| "symbol": "get_optional_admin_session_token", | |
| "file": "fief/dependencies/admin_session.py", | |
| "lines": "16", | |
| "notes": "Reached via Depends from get_admin_session_token (admin_session.py:31-32). HMAC-SHA256-hashes the opaque cookie value with get_token_hash (fief/crypto/token.py:8) and resolves it against stored sessions via repository.get_by_token (admin_session.py:25), returning the AdminSessionToken (principal) or None." | |
| }, | |
| { | |
| "role": "Session manager", | |
| "status": "present", | |
| "symbol": "get_by_token", | |
| "file": "fief/repositories/admin_session_token.py", | |
| "lines": "12", | |
| "notes": "Called by get_optional_admin_session_token at fief/dependencies/admin_session.py:25. AdminSessionTokenRepository queries the admin_session_tokens table (model fief/models/admin_session_token.py:14) by token hash; sessions are created at dashboard login and hold the userinfo/sub. No expiry check is performed in this lookup." | |
| }, | |
| { | |
| "role": "Authorisation enforcer", | |
| "status": "present", | |
| "symbol": "is_authenticated_admin_session", | |
| "file": "fief/dependencies/admin_authentication.py", | |
| "lines": "14", | |
| "notes": "Router-level dependency on all dashboard routers (e.g. fief/apps/dashboard/routers/users.py:81); receives the session from get_admin_session_token (line 16), loads the user, fetches permissions and raises 403 if the user lacks the admin permission. The decision is inline, so this method is also the Decider." | |
| }, | |
| { | |
| "role": "Decider", | |
| "status": "present", | |
| "symbol": "is_authenticated_admin_session", | |
| "file": "fief/dependencies/admin_authentication.py", | |
| "lines": "14", | |
| "notes": "Same method as the Authorisation enforcer: the decision `if ADMIN_PERMISSION_CODENAME not in permissions: raise HTTPException(403)` is inline (admin_authentication.py:28-29), with ADMIN_PERMISSION_CODENAME='fief:admin' (fief/services/admin.py:1). Privileges are obtained by calling get_user_permissions(user) at line 27." | |
| }, | |
| { | |
| "role": "Policy provider", | |
| "status": "present", | |
| "symbol": "_get_user_permissions", | |
| "file": "fief/dependencies/permission.py", | |
| "lines": "59", | |
| "notes": "Inner function returned by get_user_permissions_getter (permission.py:56), injected into is_authenticated_admin_session and called at admin_authentication.py:27. It lists the user's permission codenames from the DB using PermissionRepository.get_user_permissions_statement (fief/repositories/permission.py:16, join on user_permissions)." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "present", | |
| "symbol": "list_users", | |
| "file": "fief/apps/dashboard/routers/users.py", | |
| "lines": "138", | |
| "notes": "Example protected dashboard handler (GET /admin/users/) on the users router guarded by Depends(is_authenticated_admin_session) at users.py:81; runs only after both checks pass. All other dashboard routers (tenants, clients, webhooks, ...) are protected the same way." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 4.18 kB
- Xet hash:
- 1e825b99140955ae9a109e8610737cd4acb19175be263a5ca98b719aaf06cd84
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.