Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /verifiable_token_based_authentication /calkit_calkit.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Subject", | |
| "status": "present", | |
| "symbol": "get_headers", | |
| "file": "calkit/hub.py", | |
| "lines": "347", | |
| "notes": "The calkit CLI/SDK client calls the in-repo Calkit Hub backend; get_headers builds 'Authorization: Bearer {get_token()}' (calkit/hub.py:349), where get_token (calkit/hub.py:260) returns a PAT or the short-lived JWT access_token from device login. The JWT case reaches the Enforcer get_current_user in hub/backend/app/api/deps.py:79." | |
| }, | |
| { | |
| "role": "Enforcer", | |
| "status": "present", | |
| "symbol": "get_current_user", | |
| "file": "hub/backend/app/api/deps.py", | |
| "lines": "79", | |
| "notes": "FastAPI dependency get_current_user receives the Bearer token via OAuth2PasswordBearer (deps.py:27, TokenDep deps.py:75) and is installed on routes through CurrentUser = Annotated[User, Depends(get_current_user)] (deps.py:262); it raises HTTP 403 when verification fails. The JWT branch (non-'ckp_' tokens) is the traced flow; the 'ckp_' PAT branch is an opaque-token lookup outside this pattern." | |
| }, | |
| { | |
| "role": "Verifier", | |
| "status": "present", | |
| "symbol": "get_current_user", | |
| "file": "hub/backend/app/api/deps.py", | |
| "lines": "79", | |
| "notes": "Verification is inline in the Enforcer method (same unit as Enforcer): jwt.decode at deps.py:107 checks signature and exp, then TokenPayload validation, scope rejection, optional token_id revocation check, and resolves the principal via session.get(User, sub) (deps.py:124). Sibling get_current_user_with_token_scope (deps.py:181) duplicates this for dvc-scoped routes." | |
| }, | |
| { | |
| "role": "Key manager", | |
| "status": "present", | |
| "symbol": "SECRET_KEY", | |
| "file": "hub/backend/app/config.py", | |
| "lines": "79", | |
| "notes": "Reached from the Verifier's jwt.decode(token, settings.SECRET_KEY, ...) at deps.py:107-108. SECRET_KEY is a pydantic Settings field (class Settings, config.py:69) loaded from env with a random default; no retrieving method exists, so the field is cited. Same key signs tokens in create_access_token (security.py:67)." | |
| }, | |
| { | |
| "role": "Cryptographer", | |
| "status": "external", | |
| "symbol": "decode", | |
| "file": "hub/backend/app/api/deps.py", | |
| "lines": "107", | |
| "notes": "The Verifier get_current_user calls PyJWT jwt.decode with HS256 (security.ALGORITHM, security.py:21) and SECRET_KEY, which verifies the HMAC signature and expiry. Generation counterpart is jwt.encode in create_access_token (security.py:67)." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "present", | |
| "symbol": "get_current_user", | |
| "file": "hub/backend/app/api/routes/users.py", | |
| "lines": "210", | |
| "notes": "Example protected handler: GET /user route (users.py:209-210) takes current_user: CurrentUser, so it runs only after the Enforcer deps.py:79 returns the principal, and replies with the user's public profile. Many other routes (projects, orgs, datasets) use the same CurrentUser dependency." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 3.07 kB
- Xet hash:
- 53766e08e98c2dab34ee078c7dd5f8feee1d37fdeb3f714c415565b731662bc1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.