Buckets:

download
raw
3.03 kB
{
"role_mappings": [
{
"role": "Subject",
"status": "missing",
"symbol": "",
"file": "",
"lines": "",
"notes": "fastapi-users is a server-side library; no in-repo client (UI/SDK/CLI) sends the Bearer/cookie JWT to the Authenticator dependency. Only tests and docs/examples call the endpoints, which do not count."
},
{
"role": "Enforcer",
"status": "present",
"symbol": "_authenticate",
"file": "fastapi_users/authentication/authenticator.py",
"lines": "153",
"notes": "Authenticator._authenticate is invoked by the FastAPI dependency current_user_dependency (authenticator.py:141), which routes declare via Depends(get_current_active_user) (router/users.py:19,47); the token is extracted by the transport scheme (OAuth2PasswordBearer in transport/bearer.py) wired at authenticator.py:218. It calls strategy.read_token (authenticator.py:175) and raises HTTPException 401/403 (authenticator.py:190) when no valid user results."
},
{
"role": "Verifier",
"status": "present",
"symbol": "read_token",
"file": "fastapi_users/authentication/strategy/jwt.py",
"lines": "43",
"notes": "Reached from Enforcer _authenticate at authenticator.py:175. JWTStrategy.read_token calls decode_jwt with decode_key, audience and algorithm (jwt.py:50), returns None on PyJWTError or missing 'sub', then resolves the principal via user_manager.get. Alternative strategies (DatabaseStrategy, RedisStrategy) are opaque-token lookups and not this pattern."
},
{
"role": "Key manager",
"status": "present",
"symbol": "decode_key",
"file": "fastapi_users/authentication/strategy/jwt.py",
"lines": "40",
"notes": "Verifier read_token reads self.decode_key at strategy/jwt.py:51; this property returns public_key (asymmetric) or the shared secret (HS256 default) configured in JWTStrategy.__init__ (strategy/jwt.py:21). _get_secret_value (fastapi_users/jwt.py:11) unwraps a SecretStr; the secret itself is supplied by the application developer."
},
{
"role": "Cryptographer",
"status": "external",
"symbol": "decode",
"file": "fastapi_users/jwt.py",
"lines": "36",
"notes": "Verifier read_token calls wrapper decode_jwt (strategy/jwt.py:50 -> fastapi_users/jwt.py:30), which calls PyJWT jwt.decode here; PyJWT verifies the HMAC/signature, exp and aud. Token generation uses jwt.encode at fastapi_users/jwt.py:27 (generate_jwt)."
},
{
"role": "System",
"status": "present",
"symbol": "me",
"file": "fastapi_users/router/users.py",
"lines": "46",
"notes": "The library's own users router handler GET /me depends on get_current_active_user = authenticator.current_user(active=True, ...) (router/users.py:19), i.e. the traced Enforcer; it runs only after _authenticate returns a user and returns the principal's data. Other handlers (update_me, superuser routes) use the same enforcer."
}
]
}

Xet Storage Details

Size:
3.03 kB
·
Xet hash:
d37f1e89c15e034894995198ad51a800dc57a341a125f556e4cd103c7571c64b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.