Skip to content

THREESCALE-12102: Add token_exchange_enabled OIDC flow toggle#4313

Open
madnialihussain wants to merge 1 commit into
masterfrom
THREESCALE-12102-support-token-exchange
Open

THREESCALE-12102: Add token_exchange_enabled OIDC flow toggle#4313
madnialihussain wants to merge 1 commit into
masterfrom
THREESCALE-12102-support-token-exchange

Conversation

@madnialihussain
Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds token_exchange_enabled as a new OIDC flow toggle. This allows admins to enable/disable Standard Token Exchange (V2) on Keycloak clients via the 3scale UI and API, instead of configuring Keycloak manually.

Ticket requirements (THREESCALE-12102):

  1. Add native support in APIcast for validating OBO tokens: (Verified). APIcast validates OBO tokens out of the box since they are standard JWTs. Tested by obtaining an OBO token via Keycloak token exchange and sending it through APIcast, returned HTTP 200.

  2. Ensure compatibility with RHBK Standard Token Exchange (V2): This PR (Porta) + companion Zync PR. Adds the UI/API toggle in Porta that flows through Zync to set standard.token.exchange.enabled on the Keycloak client. Verified end-to-end: toggle ON → Keycloak shows true, toggle OFF → shows false.

  3. Provide configuration options to enforce policies based on both client and user claims: (Verified). The OBO token contains both client claims (azp, client_id) and user claims (sub, preferred_username, email, roles). APIcast extracts the client identity via jwt_claim_with_client_id (mapped to azp) for rate limiting, and existing policies like keycloak_role_check can enforce rules on user roles. Tested with an unknown client azp → APIcast returned HTTP 403.

Which issue(s) this PR fixes

https://redhat.atlassian.net/browse/THREESCALE-12102

Verification steps

  1. Navigate to a service's Integration > Settings > OpenID Connect > OIDC Authorization Flow
  2. Verify a "Token Exchange Flow" checkbox appears
  3. Toggle it on/off and save
  4. Verify via API: GET /admin/api/services/{id}/proxy/oidc_configuration.json returns token_exchange_enabled: true/false
  5. Run tests: bundle exec rails test test/models/oidc_configuration_test.rb

Note: End-to-end testing (Porta → Zync → Keycloak → APIcast) was done by temporarily cherry-picking commits from PR#4310 (OIDC sync token rotation). Will re-test after #4310 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant