From e08725e730332adf98626df4ff45663addf6bd1f Mon Sep 17 00:00:00 2001 From: mhajas Date: Fri, 14 Oct 2016 12:47:31 +0200 Subject: [PATCH] KEYCLOAK-3654 Fix jwks-url in integration-arquillian --- .../testsuite/adapter/AbstractAdapterTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractAdapterTest.java index 63821b3bcc..4317317908 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractAdapterTest.java @@ -70,6 +70,7 @@ public abstract class AbstractAdapterTest extends AbstractAuthTest { modifyClientUrls(tr, "^(/.*)", appServerContextRootPage.toString() + "$1"); modifySamlMasterURLs(tr, "8080", System.getProperty("auth.server.http.port", null)); modifySAMLClientsAttributes(tr, "8080", System.getProperty("app.server.http.port", "8280")); + modifyClientJWKSUrl(tr, "^(/.*)", appServerContextRootPage.toString() + "$1"); } if ("true".equals(System.getProperty("auth.server.ssl.required"))) { tr.setSslRequired("all"); @@ -77,6 +78,16 @@ public abstract class AbstractAdapterTest extends AbstractAuthTest { } } + private void modifyClientJWKSUrl(RealmRepresentation realm, String regex, String replacement) { + if (realm.getClients() != null) { + realm.getClients().stream().filter(client -> "client-jwt".equals(client.getClientAuthenticatorType())).forEach(client -> { + Map attr = client.getAttributes(); + attr.put("jwks.url", attr.get("jwks.url").replaceFirst(regex, replacement)); + client.setAttributes(attr); + }); + } + } + public abstract void addAdapterTestRealms(List testRealms); public boolean isRelative() {