Skip to content

Migrate KcOidcBrokerVaultTest - #52388

Merged
pedroigor merged 2 commits into
keycloak:mainfrom
sguilhen:52248-broker-oidc-vault
Sep 4, 2026
Merged

pedroigor merged 2 commits into
keycloak:mainfrom
sguilhen:52248-broker-oidc-vault

Conversation

@sguilhen

@sguilhen sguilhen commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Migrates KcOidcBrokerVaultTest to the new JUnit 5 framework, landing in tests/base/.../broker/oidc/. Configures the file-based vault provider and sets the IdP client secret to a vault expression, verifying broker login works with vault-resolved secrets.

Two commits, following the project's move-then-adapt pattern.

Also removes the legacy KcOidcBrokerVaultConfiguration and its now-orphaned vault fixture file (testsuite/.../src/test/resources/vault/consumer_oidc__idp) - both had this test as their only consumer (confirmed via grep).

Adapted to the merged abstract-class baseline: the concrete class extends AbstractKcOidcBrokerTest with no realm field overrides (both provider and consumer use the default config) - just the @BeforeEach that points the consumer IdP's client secret at the vault expression, and the @KeycloakIntegrationTest server config that enables the file vault.

Carries forward the fixes from #52372/#52376/#52379/#52382/#52383/#52387 (independently re-derived per batch, this branch is off upstream/main): visibility widening, configureBrokerEndpoints() placeholder-matching fix, enableUnmanagedAttributes(), disableUpdateProfileOnFirstLogin(), and assertUserCreatedInConsumerRealm().

Testing

  • mvn test -Dtest=KcOidcBrokerVaultTest - 2/2 green
  • Re-ran KcOidcBrokerTest, KcOidcBrokerClientSecretBasicAuthTest, KcSamlBrokerTest (phase-1 baseline) - 6/6 green
  • mvn spotless:check clean

Closes #52248

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Migrates KcOidcBrokerVaultTest from the legacy Arquillian suite to the new JUnit 5 testframework suite, configuring a file-based vault provider and verifying broker login works with vault-resolved IdP client secrets.

Changes:

  • Replaced the legacy KcOidcBrokerVaultTest + KcOidcBrokerVaultConfiguration with a new JUnit 5 KcOidcBrokerVaultTest under tests/base/.../broker/oidc/ using @KeycloakIntegrationTest.
  • Updated OIDC broker base logic to locate the provider-side “consumer client” by placeholder redirect URI rather than by a fixed clientId.
  • Added shared broker-test utilities to enable unmanaged user attributes and reliably bypass the first-broker-login review-profile interruption; added a reusable “user created” assertion hook.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/KcOidcBrokerVaultTest.java Removes legacy Arquillian vault test entrypoint.
testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/KcOidcBrokerVaultConfiguration.java Removes legacy broker configuration that injected the vault secret.
tests/base/src/test/java/org/keycloak/tests/broker/oidc/KcOidcBrokerVaultTest.java Adds JUnit 5 integration test configuring file vault + setting IdP secret to a vault expression.
tests/base/src/test/java/org/keycloak/tests/broker/AbstractKcOidcBrokerTest.java Adjusts endpoint configuration to match provider client via placeholder redirect URI.
tests/base/src/test/java/org/keycloak/tests/broker/AbstractBrokerTest.java Adds shared setup for unmanaged attributes + helper to disable review-profile/VERIFY_PROFILE behavior.
tests/base/src/test/java/org/keycloak/tests/broker/AbstractBrokerLoginTest.java Ensures post-login assertion that the consumer user is created; exposes helper for overrides.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Pure git rename of the legacy vault broker test into the new testsuite oidc
package. No content changes; the new-testsuite adaptation follows in the
next commit.

Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
Copilot AI review requested due to automatic review settings September 4, 2026 15:58
@sguilhen
sguilhen force-pushed the 52248-broker-oidc-vault branch from 5c2c928 to 4874957 Compare September 4, 2026 15:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Approval assessments conflict, and the orphaned legacy vault fixture remains unresolved.

Review details
  • Files reviewed: 3/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Configures the file-based vault provider and sets the IDP client secret
to a vault expression, verifying that broker login works with vault-resolved
secrets. Also removes the legacy KcOidcBrokerVaultConfiguration and its
now-orphaned vault fixture file (its only consumer, this test, is migrated).

Adapted to the merged abstract-class baseline: the concrete class extends
AbstractKcOidcBrokerTest with no realm field overrides (both provider and
consumer use the default config), just the @beforeeach that points the
consumer IDP's client secret at the vault expression, and the
@KeycloakIntegrationTest server config that enables the file vault.

Carries forward the fixes from prior batches (independently re-derived per
batch since this branch is off upstream/main): visibility widening,
configureBrokerEndpoints() placeholder-matching fix, enableUnmanagedAttributes(),
disableUpdateProfileOnFirstLogin(), and the assertUserCreatedInConsumerRealm()
extraction.

Closes keycloak#52248

Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
Copilot AI review requested due to automatic review settings September 4, 2026 16:13
@sguilhen
sguilhen force-pushed the 52248-broker-oidc-vault branch from 4874957 to 3516505 Compare September 4, 2026 16:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The migration is covered by passing tests, and no unresolved issues were identified.

Review details
  • Files reviewed: 4/5 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@pedroigor
pedroigor merged commit 02f737d into keycloak:main Sep 4, 2026
94 checks passed
@sguilhen
sguilhen deleted the 52248-broker-oidc-vault branch September 21, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate KcOidcBrokerVaultTest

3 participants