feat(auth): add JWT Bearer token authentication support#74
Open
arne-aignx wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
|
cbcd752 to
0d8c0bd
Compare
Extends api.auth to accept Auth0 JWT Bearer tokens alongside existing cookie-based sessions. Bearer auth is opt-in via AUTH_JWT_ENABLED and AUTH_JWT_AUDIENCE; each require_* dependency tries Bearer first, then falls back to cookie. Adds JWKS fetching with per-domain TTL cache. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31d1397 to
7d84586
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
api.authto accept Auth0 JWT Bearer tokens alongside existing cookie-based sessionsAUTH_JWT_ENABLED=trueandAUTH_JWT_AUDIENCE=<audience>; eachrequire_*dependency tries Bearer first, then falls back to cookieAUTH0_JWKS_CACHE_TTL = 3600s)AuthSettingsfields:cookie_enabled(primary name, replaces deprecatedenabled),jwt_enabled,jwt_audienceHTTPBearersecurity schemes for all four OpenAPI dependency variantsPyJWT[cryptography]>=2.10,<3,httpx>=0.28,<1Test plan
mise run lintpasses (ruff + pyright)mise run test_unitpasses (all existing + newAuthSettingsand_validate_jwtunit tests)mise run test_integrationpassesAUTH_JWT_ENABLED=false(default): Bearer tokens are ignored, cookie path unchangedAUTH_JWT_ENABLED=truewith valid Bearer token: JWT validated, cookie path skippedAUTH_JWT_ENABLED=truewith invalid/expired Bearer token: falls back to cookie🤖 Generated with Claude Code