From f0b13852e55e4758c2cc074ea4d8dba701e5ae60 Mon Sep 17 00:00:00 2001 From: Stefan Guilhen Date: Fri, 4 Sep 2026 13:00:09 -0300 Subject: [PATCH] Fix stale provider client lookup in KcSamlSignedDocumentOnlyBrokerTest configureSamlBrokerEndpoints() (AbstractKcSamlBrokerTest's @BeforeEach, which runs before this subclass's own @BeforeEach) already renames the provider-side client from its seeded placeholder entity id to the consumer realm's actual base URL. This test's @BeforeEach was still looking the client up by the old placeholder literal, which only worked because the test framework currently always binds to http://localhost:8080 by default. Look it up by the same value configureSamlBrokerEndpoints() renamed it to instead. Signed-off-by: Stefan Guilhen --- .../broker/saml/KcSamlSignedDocumentOnlyBrokerTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/base/src/test/java/org/keycloak/tests/broker/saml/KcSamlSignedDocumentOnlyBrokerTest.java b/tests/base/src/test/java/org/keycloak/tests/broker/saml/KcSamlSignedDocumentOnlyBrokerTest.java index a9164741455d..9d4daa4e58bf 100644 --- a/tests/base/src/test/java/org/keycloak/tests/broker/saml/KcSamlSignedDocumentOnlyBrokerTest.java +++ b/tests/base/src/test/java/org/keycloak/tests/broker/saml/KcSamlSignedDocumentOnlyBrokerTest.java @@ -21,7 +21,10 @@ void configureSignedDocumentOnly() { String providerSigningCert = activeRs256SigCert(providerRealm); String consumerSigningCert = activeRs256SigCert(consumerRealm); - String samlClientId = "http://localhost:8080/realms/" + CONSUMER_REALM; + // AbstractKcSamlBrokerTest.configureSamlBrokerEndpoints() (superclass @BeforeEach, runs before + // this one) already renamed the provider client from the seeded placeholder entity id to the + // consumer's actual base URL, so that's the id to look up here, not the placeholder. + String samlClientId = consumerRealm.getBaseUrl(); ClientRepresentation client = providerRealm.admin().clients().findByClientId(samlClientId).get(0); client.getAttributes().put(SamlConfigAttributes.SAML_ASSERTION_SIGNATURE, "false"); client.getAttributes().put(SamlConfigAttributes.SAML_SERVER_SIGNATURE, "true");