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 11c17f0cd8..3fffb24768 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 @@ -95,28 +95,32 @@ public abstract class AbstractAdapterTest extends AbstractAuthTest { } protected void modifyClientWebOrigins(RealmRepresentation realm, String regex, String replacement) { - for (ClientRepresentation client : realm.getClients()) { - List webOrigins = client.getWebOrigins(); - if (webOrigins != null) { - List newWebOrigins = new ArrayList<>(); - for (String uri : webOrigins) { - newWebOrigins.add(uri.replaceAll(regex, replacement)); + if (realm.getClients() != null) { + for (ClientRepresentation client : realm.getClients()) { + List webOrigins = client.getWebOrigins(); + if (webOrigins != null) { + List newWebOrigins = new ArrayList<>(); + for (String uri : webOrigins) { + newWebOrigins.add(uri.replaceAll(regex, replacement)); + } + client.setWebOrigins(newWebOrigins); } - client.setWebOrigins(newWebOrigins); } } } protected void modifySamlMasterURLs(RealmRepresentation realm, String regex, String replacement) { - for (ClientRepresentation client : realm.getClients()) { - if (client.getProtocol() != null && client.getProtocol().equals("saml")) { - log.info("Modifying master URL of SAML client: " + client.getClientId()); - String masterUrl = client.getAdminUrl(); - if (masterUrl == null) { - masterUrl = client.getBaseUrl(); + if (realm.getClients() != null) { + for (ClientRepresentation client : realm.getClients()) { + if (client.getProtocol() != null && client.getProtocol().equals("saml")) { + log.info("Modifying master URL of SAML client: " + client.getClientId()); + String masterUrl = client.getAdminUrl(); + if (masterUrl == null) { + masterUrl = client.getBaseUrl(); + } + masterUrl = masterUrl.replaceFirst(regex, replacement); + client.setAdminUrl(masterUrl); } - masterUrl = masterUrl.replaceFirst(regex, replacement); - client.setAdminUrl(masterUrl); } } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/demorealm.json b/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/demorealm.json index 70dc85aae4..1c3ca7523a 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/demorealm.json +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/adapter-test/demorealm.json @@ -121,19 +121,19 @@ "name": "customer-portal", "enabled": true, "directAccessGrantsEnabled": true, - "adminUrl": "http://localhost:8081/customer-portal", - "baseUrl": "http://localhost:8081/customer-portal", + "adminUrl": "/customer-portal", + "baseUrl": "/customer-portal", "redirectUris": [ - "http://localhost:8081/customer-portal/*" + "/customer-portal/*" ], "secret": "password" }, { "name": "customer-cookie-portal", "enabled": true, - "baseUrl": "http://localhost:8081/customer-cookie-portal", + "baseUrl": "/customer-cookie-portal", "redirectUris": [ - "http://localhost:8081/customer-cookie-portal/*" + "/customer-cookie-portal/*" ], "secret": "password" }, @@ -141,10 +141,10 @@ "name": "customer-portal-js", "enabled": true, "publicClient": true, - "adminUrl": "http://localhost:8081/customer-portal-js", - "baseUrl": "http://localhost:8081/customer-portal-js", + "adminUrl": "/customer-portal-js", + "baseUrl": "/customer-portal-js", "redirectUris": [ - "http://localhost:8080/customer-portal-js/*" + "/customer-portal-js/*" ] }, { @@ -159,21 +159,21 @@ { "name": "product-portal", "enabled": true, - "adminUrl": "http://localhost:8081/product-portal", - "baseUrl": "http://localhost:8081/product-portal", + "adminUrl": "/product-portal", + "baseUrl": "/product-portal", "redirectUris": [ - "http://localhost:8081/product-portal/*" + "/product-portal/*" ], "secret": "password" }, { "name": "secure-portal", "enabled": true, - "adminUrl": "http://localhost:8081/secure-portal", - "baseUrl": "http://localhost:8081/secure-portal", + "adminUrl": "/secure-portal", + "baseUrl": "/secure-portal", "clientAuthenticatorType": "client-jwt", "redirectUris": [ - "http://localhost:8081/secure-portal/*" + "/secure-portal/*" ], "attributes": { "jwt.credential.certificate": "MIICnTCCAYUCBgFPPLDaTzANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQDDAdjbGllbnQxMB4XDTE1MDgxNzE3MjI0N1oXDTI1MDgxNzE3MjQyN1owEjEQMA4GA1UEAwwHY2xpZW50MTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAIUjjgv+V3s96O+Za9002Lp/trtGuHBeaeVL9dFKMKzO2MPqdRmHB4PqNlDdd28Rwf5Xn6iWdFpyUKOnI/yXDLhdcuFpR0sMNK/C9Lt+hSpPFLuzDqgtPgDotlMxiHIWDOZ7g9/gPYNXbNvjv8nSiyqoguoCQiiafW90bPHsiVLdP7ZIUwCcfi1qQm7FhxRJ1NiW5dvUkuCnnWEf0XR+Wzc5eC9EgB0taLFiPsSEIlWMm5xlahYyXkPdNOqZjiRnrTWm5Y4uk8ZcsD/KbPTf/7t7cQXipVaswgjdYi1kK2/zRwOhg1QwWFX/qmvdd+fLxV0R6VqRDhn7Qep2cxwMxLsCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAKE6OA46sf20bz8LZPoiNsqRwBUDkaMGXfnob7s/hJZIIwDEx0IAQ3uKsG7q9wb+aA6s+v7S340zb2k3IxuhFaHaZpAd4CyR5cn1FHylbzoZ7rI/3ASqHDqpljdJaFqPH+m7nZWtyDvtZf+gkZ8OjsndwsSBK1d/jMZPp29qYbl1+XfO7RCp/jDqro/R3saYFaIFiEZPeKn1hUJn6BO48vxH1xspSu9FmlvDOEAOz4AuM58z4zRMP49GcFdCWr1wkonJUHaSptJaQwmBwLFUkCbE5I1ixGMb7mjEud6Y5jhfzJiZMo2U8RfcjNbrN0diZl3jB6LQIwESnhYSghaTjNQ==" @@ -182,20 +182,20 @@ { "name": "session-portal", "enabled": true, - "adminUrl": "http://localhost:8081/session-portal", - "baseUrl": "http://localhost:8081/session-portal", + "adminUrl": "/session-portal", + "baseUrl": "/session-portal", "redirectUris": [ - "http://localhost:8081/session-portal/*" + "/session-portal/*" ], "secret": "password" }, { "name": "input-portal", "enabled": true, - "adminUrl": "http://localhost:8081/input-portal", - "baseUrl": "http://localhost:8081/input-portal", + "adminUrl": "/input-portal", + "baseUrl": "/input-portal", "redirectUris": [ - "http://localhost:8081/input-portal/*" + "/input-portal/*" ], "secret": "password" } @@ -205,8 +205,8 @@ "name": "third-party", "enabled": true, "redirectUris": [ - "http://localhost:8081/oauth-client/*", - "http://localhost:8081/oauth-client-cdi/*" + "/oauth-client/*", + "/oauth-client-cdi/*" ], "secret": "password" }