Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /verifiable_token_based_authentication /holgi_fastapi-permissions.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Subject", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "No in-repo client sends the bearer token to the example app; the only caller that does is tests/test_example_app.py:9 (Authorization: Bearer header), and tests do not count. The real caller is an outside HTTP client." | |
| }, | |
| { | |
| "role": "Enforcer", | |
| "status": "present", | |
| "symbol": "get_current_user", | |
| "file": "fastapi_permissions/example.py", | |
| "lines": "129", | |
| "notes": "FastAPI dependency in the shipped example app; it takes the bearer token through Depends(oauth2_scheme) (OAuth2PasswordBearer, example.py:91) and raises HTTP 401 credentials_exception when verification fails. It is wired via Depends(get_current_user) on read_users_me (example.py:241) and show_items (example.py:264), and via get_active_principals (example.py:200) -> configure_permissions (example.py:217) for the Permission-guarded routes. The same function is also the Verifier, because the decision logic is inline; caveat: the flow only exists in the example module, the library itself (__init__.py) does ACL authorisation only." | |
| }, | |
| { | |
| "role": "Verifier", | |
| "status": "present", | |
| "symbol": "get_current_user", | |
| "file": "fastapi_permissions/example.py", | |
| "lines": "129", | |
| "notes": "Reached from the Enforcer, which is the same method (decision logic is inline, no smaller helper decides). It calls jwt.decode at example.py:136 with SECRET_KEY and algorithms=[HS256], rejects tokens without a 'sub' claim (example.py:138) or with PyJWTError/ValidationError (example.py:140), resolves the user via get_user (example.py:142) and returns the user principal or raises 401." | |
| }, | |
| { | |
| "role": "Key manager", | |
| "status": "present", | |
| "symbol": "SECRET_KEY", | |
| "file": "fastapi_permissions/example.py", | |
| "lines": "31", | |
| "notes": "Reached from the Verifier get_current_user, which passes SECRET_KEY directly to jwt.decode at example.py:136 (and create_access_token uses it for signing at example.py:125). No method retrieves or derives the key, so the hard-coded HMAC secret constant is cited; caveat: it is a static hard-coded key with no rotation." | |
| }, | |
| { | |
| "role": "Cryptographer", | |
| "status": "external", | |
| "symbol": "decode", | |
| "file": "fastapi_permissions/example.py", | |
| "lines": "136", | |
| "notes": "Reached from the Verifier get_current_user (example.py:129); PyJWT's jwt.decode (imported at example.py:4) verifies the HS256 HMAC signature with SECRET_KEY and checks the exp claim. The same library's jwt.encode signs tokens in create_access_token (example.py:125) on the issuing side." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "present", | |
| "symbol": "read_users_me", | |
| "file": "fastapi_permissions/example.py", | |
| "lines": "241", | |
| "notes": "GET /me/ handler that receives the principal from the Enforcer via Depends(get_current_user) at example.py:241 and returns the current user. Other handlers behind the same enforcer are show_items (example.py:262) and show_item/use_item (example.py:297, 307) via the Permission dependency." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 3.23 kB
- Xet hash:
- 4b5dbdc5bf771707a2e5837f146fa304333136e63ca85444be92f263111765cb
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.