Repository navigation
Conversation
There was a problem hiding this comment.
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 the remaining OIDC broker private-key-jwt legacy tests and their supporting custom providers to the new JUnit 5 test framework and tests/* layout.
Changes:
- Removes 3 legacy
testsuite/integration-arquillianbroker tests and replaces them with JUnit 5 equivalents undertests/base/.../broker/oidc/. - Moves custom RealmResourceProviders and a ClientAuthenticator SPI registration from
testsuite-providerstotests/custom-providers. - Updates shared broker test base utilities (endpoint matching, user-profile settings, and common post-login assertion helper).
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/KcOidcBrokerPrivateKeyJwtUnsupportedKeyTest.java | Removes legacy JUnit 4 test (migrated to tests/base). |
| testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/KcOidcBrokerPrivateKeyJwtMissingUseTest.java | Removes legacy JUnit 4 test (migrated to tests/base). |
| testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/KcOidcBrokerPrivateKeyJwtClientIdRequiredTest.java | Removes legacy JUnit 4 test (migrated to tests/base). |
| testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/resources/META-INF/services/org.keycloak.services.resource.RealmResourceProviderFactory | Drops provider registrations from testsuite-providers (moved to tests/custom-providers). |
| testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/resources/META-INF/services/org.keycloak.authentication.ClientAuthenticatorFactory | Drops client authenticator registration from testsuite-providers (moved to tests/custom-providers). |
| testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/broker/oidc/UnsupportedKeyJwksRestResource.java | Refactors old REST resource into a RealmResourceProvider (but currently with naming/packaging issues). |
| testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/broker/oidc/UnsupportedKeyJwksRealmResourceProviderFactory.java | Updates factory package (but currently appears to remain under old module path). |
| testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/broker/oidc/UnsupportedKeyJwksRealmResourceProvider.java | Removes old wrapper provider (now inlined into the resource/provider class). |
| testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/broker/oidc/MissingUseJwksRestResource.java | Refactors old REST resource into a RealmResourceProvider (but currently with naming/packaging issues). |
| testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/broker/oidc/MissingUseJwksRealmResourceProviderFactory.java | Updates factory package (but currently appears to remain under old module path). |
| testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/broker/oidc/MissingUseJwksRealmResourceProvider.java | Removes old wrapper provider (now inlined into the resource/provider class). |
| testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/broker/oidc/ClientIdRequiredJWTClientAuthenticator.java | Moves authenticator into org.keycloak.tests.providers... package (but currently appears to remain under old module path). |
| tests/custom-providers/src/main/resources/META-INF/services/org.keycloak.services.resource.RealmResourceProviderFactory | Registers moved RealmResourceProviderFactories for the new test server config. |
| tests/custom-providers/src/main/resources/META-INF/services/org.keycloak.authentication.ClientAuthenticatorFactory | Registers moved ClientAuthenticatorFactory for the new test server config. |
| tests/base/src/test/java/org/keycloak/tests/broker/oidc/KcOidcBrokerPrivateKeyJwtUnsupportedKeyTest.java | Adds migrated JUnit 5 private-key-jwt unsupported-key test. |
| tests/base/src/test/java/org/keycloak/tests/broker/oidc/KcOidcBrokerPrivateKeyJwtMissingUseTest.java | Adds migrated JUnit 5 private-key-jwt missing-use test. |
| tests/base/src/test/java/org/keycloak/tests/broker/oidc/KcOidcBrokerPrivateKeyJwtClientIdRequiredTest.java | Adds migrated JUnit 5 private-key-jwt client_id-required test. |
| tests/base/src/test/java/org/keycloak/tests/broker/AbstractKcOidcBrokerTest.java | Improves provider client lookup for endpoint redirect URI rewrites; widens helper visibility. |
| tests/base/src/test/java/org/keycloak/tests/broker/AbstractBrokerTest.java | Adds user-profile / broker-flow helpers used by migrated tests. |
| tests/base/src/test/java/org/keycloak/tests/broker/AbstractBrokerLoginTest.java | Adds shared post-login assertion helper and ensures it’s invoked. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| .findFirst().orElseThrow(); | ||
|
|
||
| ClientRepresentation client = providerRealm.admin().clients().findByClientId(CLIENT_ID).get(0); | ||
| client.setClientAuthenticatorType(ClientIdRequiredJWTClientAuthenticator.PROVIDER_ID); |
dda5594 to
f318e2b
Compare
f318e2b to
706798c
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The migration preserves the legacy scenarios, correctly registers their supporting providers, and reports focused passing tests.
Review details
- Files reviewed: 17/17 changed files
- Comments generated: 0 new
- Review effort level: Balanced
706798c to
f2d93d0
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The migration preserves the legacy scenarios and provider registrations, provided the documented #52383 merge ordering is followed.
Review details
- Files reviewed: 18/18 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Pure git rename of the three legacy private-key-jwt custom-provider broker tests 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>
Migrate KcOidcBrokerPrivateKeyJwtMissingUseTest (JWKS without "use" field), KcOidcBrokerPrivateKeyJwtUnsupportedKeyTest (JWKS with unsupported EC key), and KcOidcBrokerPrivateKeyJwtClientIdRequiredTest (custom client authenticator requiring client_id in request body). Ports UnsupportedKeyJwksRealmResourceProvider(+factory) and ClientIdRequiredJWTClientAuthenticator to tests/custom-providers (each used only by the test migrated here), plus re-ports MissingUseJwksRealmResourceProvider (+factory) already added by keycloak#52383 - this branch is off upstream/main and doesn't see that not-yet-merged PR, so it's duplicated here; expect a trivial rebase/dedup on whichever of keycloak#52383/this PR lands second, since both add the exact same file. **This PR depends on keycloak#52383 landing first** so the final merged history only carries one copy. Since this migrates the last legacy consumer of MissingUseJwks (the other, KcOidcBrokerIdpPublicKeyMissingUseTest, was migrated in keycloak#52383), this is where its legacy original is finally removed, alongside UnsupportedKeyJwks and ClientIdRequiredJWTClientAuthenticator's own legacy originals (both used exclusively by the two tests migrated here) - all three confirmed via grep to have no other legacy consumers before removal. The two legacy *RestResource helper classes (MissingUseJwksRestResource, UnsupportedKeyJwksRestResource) have no new-testsuite counterpart and are dropped with their providers. License headers stripped from the ported files to match this module's existing convention. Adapted to the merged abstract-class baseline: all three concrete classes extend AbstractKcOidcBrokerTest with no realm field overrides (both provider and consumer use the default config), just their respective @beforeeach provider/client setup. 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#52247 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
f2d93d0 to
59c7ed9
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The migration preserves the tested behavior, correctly registers the relocated providers, and leaves no unresolved references or correctness issues.
Review details
- Files reviewed: 17/17 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Migrates the private-key-jwt custom-provider broker tests to the new JUnit 5 framework, landing in
tests/base/.../broker/oidc/.Two commits, following the project's move-then-adapt pattern.
Dependency on #52383
This PR depends on #52383 landing first. Both PRs port
MissingUseJwksRealmResourceProvider(+factory) totests/custom-providers- #52383 needs it forKcOidcBrokerIdpPublicKeyMissingUseTest, this PR needs it forKcOidcBrokerPrivateKeyJwtMissingUseTest. Since this branch is offupstream/mainand doesn't see #52383's not-yet-merged content, the port is duplicated here rather than reused. Whichever PR merges second will need a trivial rebase to drop the now-duplicate file addition - the content is identical either way.Since this migrates the last legacy consumer of
MissingUseJwks(the other one,KcOidcBrokerIdpPublicKeyMissingUseTest, is migrated in #52383), this PR is where its legacy original is finally removed - alongsideUnsupportedKeyJwksRealmResourceProvider(+factory) andClientIdRequiredJWTClientAuthenticator's own legacy originals, both used exclusively by the two tests migrated here (confirmed via grep - no other legacy consumers). The two legacy*RestResourcehelper classes (MissingUseJwksRestResource,UnsupportedKeyJwksRestResource) have no new-testsuite counterpart and are dropped with their providers. License headers stripped from all ported files to match this module's existing convention.Adapted to the merged abstract-class baseline: all three concrete classes extend
AbstractKcOidcBrokerTestwith no realm field overrides (both provider and consumer use the default config) - just their respective@BeforeEachprovider/client setup.Carries forward the fixes from #52372/#52376/#52379/#52382/#52383 (independently re-derived per batch, this branch is off
upstream/main): visibility widening,configureBrokerEndpoints()placeholder-matching fix,enableUnmanagedAttributes(),disableUpdateProfileOnFirstLogin(), andassertUserCreatedInConsumerRealm().Testing
mvn test -Dtest=KcOidcBrokerPrivateKeyJwtMissingUseTest,KcOidcBrokerPrivateKeyJwtUnsupportedKeyTest,KcOidcBrokerPrivateKeyJwtClientIdRequiredTest- 6/6 greenKcOidcBrokerTest,KcOidcBrokerClientSecretBasicAuthTest,KcSamlBrokerTest(phase-1 baseline) - 6/6 greenmvn spotless:checkcleanCloses #52247