Repository navigation
Migrate KcOidcBrokerIdpPublicKeyMissingUseTest and port the MissingUseJwks provider - #52383
Merged
pedroigor merged 2 commits intoSep 4, 2026
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The JWKS provider still emits use for OKP keys, contrary to its intended behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Migrates the missing-use OIDC broker test to JUnit 5 and ports its custom JWKS provider.
Changes:
- Adds and registers the custom missing-
useJWKS provider. - Migrates the broker test to
tests/base. - Updates shared broker test helpers.
File summaries
| File | Description |
|---|---|
testsuite/.../KcOidcBrokerIdpPublicKeyMissingUseTest.java |
Removes the legacy test. |
tests/custom-providers/.../RealmResourceProviderFactory |
Registers the provider factory. |
tests/custom-providers/.../MissingUseJwksRealmResourceProviderFactory.java |
Adds provider construction and ID. |
tests/custom-providers/.../MissingUseJwksRealmResourceProvider.java |
Serves the customized JWKS. |
tests/base/.../KcOidcBrokerIdpPublicKeyMissingUseTest.java |
Adds the migrated JUnit 5 test. |
tests/base/.../AbstractKcOidcBrokerTest.java |
Improves endpoint configuration and visibility. |
tests/base/.../AbstractBrokerTest.java |
Adds profile-related test helpers. |
tests/base/.../AbstractBrokerLoginTest.java |
Extracts reusable post-login assertions. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was referenced Sep 3, 2026
sguilhen
force-pushed
the
52246-broker-oidc-idp-public-key-missing-use
branch
from
September 4, 2026 11:54
26cabc6 to
57c575e
Compare
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The migration preserves the legacy behavior, correctly registers the provider, and includes appropriate regression testing.
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 0 new
- Review effort level: Balanced
sguilhen
force-pushed
the
52246-broker-oidc-idp-public-key-missing-use
branch
from
September 4, 2026 12:20
57c575e to
f31a814
Compare
…kage Pure git rename of the legacy IdP-public-key-missing-use 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>
sguilhen
force-pushed
the
52246-broker-oidc-idp-public-key-missing-use
branch
from
September 4, 2026 15:58
f31a814 to
eded7de
Compare
…eJwks provider Uses the MissingUseJwks custom provider to serve JWKS without the "use" field, verifying that broker login still works with public key validation. Ports MissingUseJwksRealmResourceProvider(+factory) from the legacy testsuite-providers module to tests/custom-providers, registered via META-INF/services. The legacy original is NOT removed - the not-yet-migrated KcOidcBrokerPrivateKeyJwtMissingUseTest (part of a later batch) still references the same "missing-use-jwks" endpoint and needs the legacy provider registration until that migration lands and removes the last legacy consumer. License headers dropped from the ported files to match this module's existing convention (no headers in the new testsuite). Adapted to the merged abstract-class baseline: the concrete class extends AbstractKcOidcBrokerTest with no realm field overrides at all (both provider and consumer use the default config), just the @beforeeach that points the consumer IDP's JWKS URL at the custom endpoint. 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#52246 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
sguilhen
force-pushed
the
52246-broker-oidc-idp-public-key-missing-use
branch
from
September 4, 2026 16:13
eded7de to
8b536ec
Compare
sguilhen
added a commit
to sguilhen/keycloak
that referenced
this pull request
Sep 4, 2026
…roviderFactory Tests propagation of the max_age parameter for brokered logins using the TestKeycloakOidcIdentityProviderFactory custom provider. The IDP is created with the test-keycloak-oidc providerId at realm setup time since providerId is immutable after creation via the admin API. Ports TestKeycloakOidcIdentityProviderFactory to tests/custom-providers. The legacy original is kept in place (not removed) - it is still used by other, not-yet-migrated legacy tests (KcCustomOidcBrokerTest, KcOidcFirstBrokerLoginTest, PasskeysKcOidcFirstBrokerLoginTest), confirmed via grep. No dependency on the other custom-provider migrations (keycloak#52383, coordinate. Adapted to the merged abstract-class baseline: extends AbstractKcOidcBrokerTest for the shared infra (provider realm uses the default config, only consumer is customized), but overrides and @Disables the two inherited login tests (testLogInAsUserInIDP, testLoginWithExistingUser) - legacy explicitly @ignore'd the same inherited test for this exact configuration (no client-forwarded prompt, custom provider factory), so this mirrors that rather than risk introducing untested, possibly-failing coverage. The two real tests (loginWithExistingUser without the "test" prefix, and testEnforceReAuthenticationWhenMaxAgeIsSet) are independent methods that exercise the max_age-specific flows directly, matching the phase-2 branch this content was sourced from. The consumer IDP clears the prompt attribute set by the shared config so the broker does not force an interactive login, mirroring the legacy KcOidcBrokerConfigurationWithPassMaxAge; without it the ignore-max-age error path is never exercised. 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#52249 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
pedroigor
pushed a commit
that referenced
this pull request
Sep 4, 2026
…roviderFactory Tests propagation of the max_age parameter for brokered logins using the TestKeycloakOidcIdentityProviderFactory custom provider. The IDP is created with the test-keycloak-oidc providerId at realm setup time since providerId is immutable after creation via the admin API. Ports TestKeycloakOidcIdentityProviderFactory to tests/custom-providers. The legacy original is kept in place (not removed) - it is still used by other, not-yet-migrated legacy tests (KcCustomOidcBrokerTest, KcOidcFirstBrokerLoginTest, PasskeysKcOidcFirstBrokerLoginTest), confirmed via grep. No dependency on the other custom-provider migrations (#52383, coordinate. Adapted to the merged abstract-class baseline: extends AbstractKcOidcBrokerTest for the shared infra (provider realm uses the default config, only consumer is customized), but overrides and @Disables the two inherited login tests (testLogInAsUserInIDP, testLoginWithExistingUser) - legacy explicitly @ignore'd the same inherited test for this exact configuration (no client-forwarded prompt, custom provider factory), so this mirrors that rather than risk introducing untested, possibly-failing coverage. The two real tests (loginWithExistingUser without the "test" prefix, and testEnforceReAuthenticationWhenMaxAgeIsSet) are independent methods that exercise the max_age-specific flows directly, matching the phase-2 branch this content was sourced from. The consumer IDP clears the prompt attribute set by the shared config so the broker does not force an interactive login, mirroring the legacy KcOidcBrokerConfigurationWithPassMaxAge; without it the ignore-max-age error path is never exercised. 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 #52249 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
pedroigor
approved these changes
Sep 4, 2026
sguilhen
added a commit
to sguilhen/keycloak
that referenced
this pull request
Sep 4, 2026
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>
pedroigor
pushed a commit
that referenced
this pull request
Sep 8, 2026
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 #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 #52383/this PR lands second, since both add the exact same file. **This PR depends on #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 #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 #52247 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates
KcOidcBrokerIdpPublicKeyMissingUseTestto the new JUnit 5 framework, landing intests/base/.../broker/oidc/. Uses a custom JWKS provider (serving keys without the"use"field) to verify broker login still works with public-key validation.Two commits, following the project's move-then-adapt pattern.
Ports
MissingUseJwksRealmResourceProvider(+factory) from the legacytestsuite-providersmodule totests/custom-providers, registered viaMETA-INF/services. The legacy original is intentionally not removed -KcOidcBrokerPrivateKeyJwtMissingUseTest(not yet migrated, tracked in #52247) references the samemissing-use-jwksendpoint and needs the legacy registration until that migration lands and removes the last legacy consumer. #52247 is flagged as depending on this PR landing first, since it reuses this ported copy instead of re-porting it.License headers dropped from the ported files to match this module's existing convention (no headers in the new testsuite, per #51859's review).
Adapted to the merged abstract-class baseline: the concrete class extends
AbstractKcOidcBrokerTestwith no realm field overrides at all (both provider and consumer use the default config) - just the@BeforeEachthat points the consumer IdP's JWKS URL at the custom endpoint.Carries forward the fixes from #52372/#52376/#52379/#52382 (independently re-derived per batch, this branch is off
upstream/main): visibility widening, theconfigureBrokerEndpoints()placeholder-matching fix,enableUnmanagedAttributes(),disableUpdateProfileOnFirstLogin(), and theassertUserCreatedInConsumerRealm()extraction.Testing
mvn test -Dtest=KcOidcBrokerIdpPublicKeyMissingUseTest- 2/2 green (required rebuilding+installingtests/custom-providerslocally first, since the test server resolves it as a Maven dependency viaCustomProvidersServerConfig)KcOidcBrokerTest,KcOidcBrokerClientSecretBasicAuthTest,KcSamlBrokerTest(phase-1 baseline) - 6/6 greenmvn spotless:checkcleanCloses #52246