Skip to content

test(oauth2): Add Keycloak exchange fixture - #1646

Draft
ZebangLI wants to merge 1 commit into
openstack-experimental:mainfrom
millionsouls:ZebangKeycloak-JWT-token-exchange-in-k3s
Draft

ZebangLI wants to merge 1 commit into
openstack-experimental:mainfrom
millionsouls:ZebangKeycloak-JWT-token-exchange-in-k3s

Conversation

@ZebangLI

Copy link
Copy Markdown
Contributor

Summary

Refs #1366.

Add a test fixture that obtains real Keycloak JWTs for a user and a service account. The test creates a temporary Keycloak realm and cleans it up after issuance. It is available through the opt-in keycloak-exchange-fixture Skaffold profile without Selenium.

For example, if Keystone discovery advertises http://keystone-rs.local/v4/oauth2/default/token, the fixture configures Keycloak to make that exact URL the sole audience of both JWTs. It checks the issuer, username, distinct subject and token IDs, and a short lifetime. This prepares realistic inputs for the exchange test.

The /token exchange and identity-mapping assertions depend on #1018. This draft does not enable the fixture in the default k3s-test run.

Test plan

  • Compiled the keycloak_token_exchange integration target with cargo test --locked -p test_federation --test keycloak_token_exchange --no-run.
  • Checked that an unreachable Keystone makes the test fail, rather than skip.
  • Parsed the Skaffold configuration and checked the test command against the path packaged in the Docker image.
  • Live k3s/Keycloak run is pending.

Mint isolated Keycloak user and service account assertions with the
Keystone token endpoint as their audience. Package the fixture as an
opt-in Skaffold verification step for issue openstack-experimental#1366.

Signed-off-by: Zebang Li <99422132+Mark101001@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

2 participants