Wire JWT middleware to all FastAPI routes #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
auth/keycloak_auth.pyimplements Keycloak JWT validation but it is not wired to any route inbackend-compliance/compliance/api/. Every endpoint is currently publicly callable without a Bearer token.Grep confirms: zero uses of
Depends(get_current_user)or@require_authacross all API route files.Required Actions
get_current_userincompliance/api/dependencies.pythat validates the Bearer token against Keycloak's JWKS endpointcurrent_user: User = Depends(get_current_user)to every router that is not intentionally publicFiles to Change
compliance/api/dependencies.py(create)compliance/api/(~20 files)main.py— add global exception handler for auth errorsAcceptance Criteria
curl -X GET https://api-dev.breakpilot.ai/api/v1/compliance/controlsreturns 401test_all_routes_require_auth