Repository navigation
Migrate JWE and ECDH-ES broker tests - #52382
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The migration preserves the legacy algorithm matrix and shared behavior with focused passing coverage.
Pull request overview
Migrates ten JWE and ECDH-ES OIDC broker tests from Arquillian to the JUnit 5 test framework.
Changes:
- Adds shared abstract classes for JWE configuration, ECDH key setup, and encrypted UserInfo testing.
- Ports all ten algorithm variants while preserving their legacy configurations.
- Restores shared broker setup and removes obsolete legacy/FIPS entries.
File summaries
| File | Description |
|---|---|
testsuite/integration-arquillian/tests/base/testsuites/fips-suite |
Removes migrated legacy tests. |
testsuite/.../broker/KcOidcBrokerJWEUserInfoJustEncryptedTest.java |
Removes legacy test. |
testsuite/.../broker/KcOidcBrokerJWETest.java |
Removes legacy JWE base test. |
testsuite/.../broker/KcOidcBrokerJWEEcdhEsP384A192GcmTest.java |
Removes legacy variant. |
testsuite/.../broker/KcOidcBrokerJWEEcdhEsP384A192CbcHs384Test.java |
Removes legacy variant. |
testsuite/.../broker/KcOidcBrokerJWEEcdhEsA256KwP521A256GcmTest.java |
Removes legacy variant. |
testsuite/.../broker/KcOidcBrokerJWEEcdhEsA256KwP521A256CbcHs512Test.java |
Removes legacy variant. |
testsuite/.../broker/KcOidcBrokerJWEEcdhEsA192KwP384A192GcmTest.java |
Removes legacy variant. |
testsuite/.../broker/KcOidcBrokerJWEEcdhEsA192KwP384A192CbcHs384Test.java |
Removes legacy variant. |
testsuite/.../broker/KcOidcBrokerJWEEcdhEsA128KwP256A128GcmTest.java |
Removes legacy variant. |
testsuite/.../broker/KcOidcBrokerJWEEcdhEsA128KwP256A128CbcHs256Test.java |
Removes legacy variant. |
testsuite/.../broker/AbstractKcOidcBrokerJWEEcdhEsTest.java |
Removes obsolete shared base. |
tests/base/.../oidc/KcOidcBrokerJWEUserInfoJustEncryptedTest.java |
Adds encrypted-only JUnit 5 variant. |
tests/base/.../oidc/KcOidcBrokerJWETest.java |
Adds default RSA JWE variant. |
tests/base/.../oidc/KcOidcBrokerJWEEcdhEsP384A192GcmTest.java |
Adds ECDH-ES/GCM variant. |
tests/base/.../oidc/KcOidcBrokerJWEEcdhEsP384A192CbcHs384Test.java |
Adds ECDH-ES/CBC variant. |
tests/base/.../oidc/KcOidcBrokerJWEEcdhEsA256KwP521A256GcmTest.java |
Adds A256KW/P-521/GCM variant. |
tests/base/.../oidc/KcOidcBrokerJWEEcdhEsA256KwP521A256CbcHs512Test.java |
Adds A256KW/P-521/CBC variant. |
tests/base/.../oidc/KcOidcBrokerJWEEcdhEsA192KwP384A192GcmTest.java |
Adds A192KW/P-384/GCM variant. |
tests/base/.../oidc/KcOidcBrokerJWEEcdhEsA192KwP384A192CbcHs384Test.java |
Adds A192KW/P-384/CBC variant. |
tests/base/.../oidc/KcOidcBrokerJWEEcdhEsA128KwP256A128GcmTest.java |
Adds A128KW/P-256/GCM variant. |
tests/base/.../oidc/KcOidcBrokerJWEEcdhEsA128KwP256A128CbcHs256Test.java |
Adds A128KW/P-256/CBC variant. |
tests/base/.../broker/AbstractKcOidcJweBrokerTest.java |
Adds shared JWE and UserInfo behavior. |
tests/base/.../broker/AbstractKcOidcEcdhEsJweBrokerTest.java |
Adds shared ECDH key configuration. |
tests/base/.../broker/AbstractKcOidcBrokerTest.java |
Improves endpoint lookup and visibility. |
tests/base/.../broker/AbstractBrokerTest.java |
Enables unmanaged profile attributes. |
tests/base/.../broker/AbstractBrokerLoginTest.java |
Extracts reusable user assertions. |
Review details
- Files reviewed: 27/27 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#employeeSigPostNoIdpKeyTestKeycloak CI - Adapter IT Strict Cookies org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#salesPostAssertionAndResponseSigTestKeycloak CI - Adapter IT Strict Cookies org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#salesPostSigEmailTestKeycloak CI - Adapter IT Strict Cookies org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#salesPostSigTestKeycloak CI - Adapter IT Strict Cookies org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#testAdapterRoleMappingsKeycloak CI - Adapter IT Strict Cookies org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#salesPostEncTestKeycloak CI - Adapter IT Strict Cookies org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#idpInitiatedUnauthorizedLoginTestKeycloak CI - Adapter IT Strict Cookies org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#salesPostEncSignedAssertionsOnlyTestKeycloak CI - Adapter IT Strict Cookies org.keycloak.testsuite.broker.KcOidcBrokerTest#loginWithExistingUserWithBruteForceEnabledKeycloak CI - Java Distribution IT (windows-latest - temurin - 21) |
Pure git rename of the ten legacy JWE and ECDH-ES 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>
86fd4a6 to
42dffaf
Compare
Migrate KcOidcBrokerJWETest (1 own test), KcOidcBrokerJWEUserInfoJustEncryptedTest, and all 8 ECDH-ES variant tests, all landing in oidc/. Architecture change from the phase-2 branch: the phase-2/interim design used interface traits (JweBrokerConfigSupport, EcdhEsJweBrokerConfigSupport, JweUserInfoBrokerTest) because that's how the whole shared support layer was built at the time. Converted to a 2-layer abstract-class extension instead - AbstractKcOidcJweBrokerTest extends AbstractKcOidcBrokerTest (JWE key/algorithm config + the shared testIdentityClaimsFromUserInfoEndpoint()), and AbstractKcOidcEcdhEsJweBrokerTest extends AbstractKcOidcJweBrokerTest (ECDH-specific key overrides + abstract getCurve()) - rather than keeping them as interfaces mixed in alongside BrokerLoginTest/EcdhEsJweBrokerConfigSupport. Re-examined whether this is genuinely a "multi-axis" case (the documented reason interfaces are reserved over abstract classes elsewhere in this migration): it isn't. Every one of the 10 variants wants the full stack - protocol config, basic login tests, and JWE support - in the same order, with no case needing to skip a layer (unlike e.g. KcOidcBrokerHiddenIdpHintTest in chain expresses this without forcing AbstractBrokerTest's protected fields/methods (oauth, webDriver, logInAsUserInIDP(), etc.) to be widened to public just so interface default methods could call them - interface methods are implicitly public, and a protected inherited method does not satisfy a public abstract interface method, so keeping these as interfaces against the current abstract-class baseline would have forced that wider visibility change. Concrete classes drop straight to their per-variant algorithm/curve overrides (4 one-line methods, or none at all for the RSA base case). Also removes the legacy AbstractKcOidcBrokerJWEEcdhEsTest shared base (all 8 subclasses migrated) and drops all 10 now-migrated class names from the legacy fips-suite list (they are not yet added to the new-testsuite FIPS suites - already tracked separately as deferred pending a test-framework HTTPS-trust fix, per the migration plan's Infrastructure section). Found and fixed another real gap in the merged AbstractBrokerTest (same category as keycloak#52244's disableUpdateProfileOnFirstLogin): enableUnmanagedAttributes() was dropped during the abstract-class rework. Without it, the declarative user profile silently drops attributes outside its managed schema - exactly what this batch's IdP mapper does (maps a custom OIDC claim onto a "user-info" user attribute), so testIdentityClaimsFromUserInfoEndpoint failed identically across all 10 variants until this was restored. Caught by running the tests, not by inspection. Carries forward the visibility widening + configureBrokerEndpoints() and assertUserCreatedInConsumerRealm() fixes from keycloak#52372/keycloak#52376/keycloak#52379 (independently re-derived per batch, this branch is off upstream/main). Closes keycloak#52245 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
42dffaf to
5cdb112
Compare
Migrates the JWE and ECDH-ES token-encryption broker tests to the new JUnit 5 framework, landing in
tests/base/.../broker/oidc/.Two commits, following the project's move-then-adapt pattern:
tests/base/.../tests/broker/oidc/with zero content changes.Other changes
AbstractKcOidcBrokerJWEEcdhEsTestshared base (all 8 subclasses migrated) and drops all 10 migrated class names from the legacyfips-suitelist. They're not yet in the new-testsuite FIPS suites - already tracked as deferred pending a test-framework HTTPS-trust fix (see the migration plan's Infrastructure section), not something this PR changes.AbstractBrokerTest:enableUnmanagedAttributes()was dropped during the abstract-class rework. Without it, the declarative user profile silently drops attributes outside its managed schema - exactly what this batch's IdP mapper does (maps a custom OIDC claim onto a "user-info" user attribute).testIdentityClaimsFromUserInfoEndpointfailed identically across all 10 variants until this was restored - caught by running the tests, not by inspection.configureBrokerEndpoints()fix, andassertUserCreatedInConsumerRealm()extraction from Migrate OIDC broker config-variant and parameter-forwarding tests #52372/Migrate OIDC client-authentication and sub-mismatch broker tests #52376/Migrate IdP-hint and nonce-parameter broker tests #52379 (independently re-derived, this branch is offupstream/main).Testing
mvn test -Dtest=KcOidcBrokerJWETest,KcOidcBrokerJWEUserInfoJustEncryptedTest,KcOidcBrokerJWEEcdhEsA128KwP256A128CbcHs256Test,KcOidcBrokerJWEEcdhEsA128KwP256A128GcmTest,KcOidcBrokerJWEEcdhEsA192KwP384A192CbcHs384Test,KcOidcBrokerJWEEcdhEsA192KwP384A192GcmTest,KcOidcBrokerJWEEcdhEsA256KwP521A256CbcHs512Test,KcOidcBrokerJWEEcdhEsA256KwP521A256GcmTest,KcOidcBrokerJWEEcdhEsP384A192CbcHs384Test,KcOidcBrokerJWEEcdhEsP384A192GcmTest- 30/30 greenKcOidcBrokerTest,KcOidcBrokerClientSecretBasicAuthTest,KcSamlBrokerTest(phase-1 baseline) - 6/6 greenmvn spotless:checkcleanCloses #52245