feat(OIDC): Add OIDC token exchange endpoint#8043
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Docker builds report
|
a9bf1ff to
5478a2a
Compare
4ea4cd6 to
70667c2
Compare
5478a2a to
b88bd0c
Compare
70667c2 to
5220d77
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Visual Regression19 screenshots compared. See report for details. |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d4edbb9c-172b-4ab1-85d2-3514610b852e
📒 Files selected for processing (23)
api/api_keys/views.pyapi/app/settings/common.pyapi/app/settings/test.pyapi/custom_auth/urls.pyapi/tests/integration/trust_relationships/conftest.pyapi/tests/integration/trust_relationships/test_token_exchange.pyapi/tests/test_helpers.pyapi/tests/unit/trust_relationships/conftest.pyapi/tests/unit/trust_relationships/test_authentication.pyapi/tests/unit/trust_relationships/test_oidc.pyapi/tests/unit/trust_relationships/test_services.pyapi/tests/unit/trust_relationships/test_token_exchange.pyapi/trust_relationships/authentication.pyapi/trust_relationships/constants.pyapi/trust_relationships/dataclasses.pyapi/trust_relationships/exceptions.pyapi/trust_relationships/oidc.pyapi/trust_relationships/serializers.pyapi/trust_relationships/services.pyapi/trust_relationships/types.pyapi/trust_relationships/views.pydocs/docs/deployment-self-hosting/observability/_events-catalogue.mdopenapi.yaml
4a9b748 to
94dff4e
Compare
dde4062 to
11cd374
Compare
94dff4e to
1c5bc06
Compare
11cd374 to
2d8d889
Compare
POST /api/v1/auth/oidc/token/ validates an external OIDC token (signature via issuer JWKS, expiry, audience, configured claim rules) against the organisation's trust relationships and mints a short-lived HS256 access token. The token resolves to the trust relationship's backing master API key at request time, so revocation and role changes apply to outstanding tokens immediately. beep boop
The exchanged token's `iss` claim was stripped of a trailing slash before the trust relationship lookup, so an issuer registered with the exact (slashed) value it presents — as Auth0 does — never matched and the exchange failed. Preserve the exact `iss` for the lookup and strip the slash only when composing the OIDC discovery URL. beep boop
✅ private-cloud · depot-ubuntu-latest-16 — run #18526 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
🗂️ Previous results✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18525 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ private-cloud · depot-ubuntu-latest-16 — run #18525 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18526 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #18525 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #18526 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #18525 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-16 — run #18526 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
|
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to #8040
In this PR, we add a
POST /api/v1/auth/oidc/token/endpoint to support the OIDC exchange flow.The incoming OIDC token is verified for:
The short-lived Bearer token is only minted if there's exactly one match: multi-audience tokens matching more than one trust relationship are rejected.
The minted token is a stateless HS256 JWT signed with
SECRET_KEY. It's valid for a configurable lifetime, 1 hour by default.A new
TrustRelationshipTokenAuthenticationauth class resolves it to the trust relationship's backing master API key and authenticates the request asAPIKeyUser. RBAC and permissions come for free.Also:
How did you test this code?
Added new unit and integration tests.