Merge pull request #2063 from tkyjovsk/KEYCLOAK-2238

Keycloak 2238 fixes for some servlet-based adapter tests
This commit is contained in:
Stian Thorgersen 2016-01-20 09:11:44 +01:00
commit 5b3fcab4c9
2 changed files with 41 additions and 37 deletions

View file

@ -95,28 +95,32 @@ public abstract class AbstractAdapterTest extends AbstractAuthTest {
} }
protected void modifyClientWebOrigins(RealmRepresentation realm, String regex, String replacement) { protected void modifyClientWebOrigins(RealmRepresentation realm, String regex, String replacement) {
for (ClientRepresentation client : realm.getClients()) { if (realm.getClients() != null) {
List<String> webOrigins = client.getWebOrigins(); for (ClientRepresentation client : realm.getClients()) {
if (webOrigins != null) { List<String> webOrigins = client.getWebOrigins();
List<String> newWebOrigins = new ArrayList<>(); if (webOrigins != null) {
for (String uri : webOrigins) { List<String> newWebOrigins = new ArrayList<>();
newWebOrigins.add(uri.replaceAll(regex, replacement)); 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) { protected void modifySamlMasterURLs(RealmRepresentation realm, String regex, String replacement) {
for (ClientRepresentation client : realm.getClients()) { if (realm.getClients() != null) {
if (client.getProtocol() != null && client.getProtocol().equals("saml")) { for (ClientRepresentation client : realm.getClients()) {
log.info("Modifying master URL of SAML client: " + client.getClientId()); if (client.getProtocol() != null && client.getProtocol().equals("saml")) {
String masterUrl = client.getAdminUrl(); log.info("Modifying master URL of SAML client: " + client.getClientId());
if (masterUrl == null) { String masterUrl = client.getAdminUrl();
masterUrl = client.getBaseUrl(); if (masterUrl == null) {
masterUrl = client.getBaseUrl();
}
masterUrl = masterUrl.replaceFirst(regex, replacement);
client.setAdminUrl(masterUrl);
} }
masterUrl = masterUrl.replaceFirst(regex, replacement);
client.setAdminUrl(masterUrl);
} }
} }
} }

View file

@ -121,19 +121,19 @@
"name": "customer-portal", "name": "customer-portal",
"enabled": true, "enabled": true,
"directAccessGrantsEnabled": true, "directAccessGrantsEnabled": true,
"adminUrl": "http://localhost:8081/customer-portal", "adminUrl": "/customer-portal",
"baseUrl": "http://localhost:8081/customer-portal", "baseUrl": "/customer-portal",
"redirectUris": [ "redirectUris": [
"http://localhost:8081/customer-portal/*" "/customer-portal/*"
], ],
"secret": "password" "secret": "password"
}, },
{ {
"name": "customer-cookie-portal", "name": "customer-cookie-portal",
"enabled": true, "enabled": true,
"baseUrl": "http://localhost:8081/customer-cookie-portal", "baseUrl": "/customer-cookie-portal",
"redirectUris": [ "redirectUris": [
"http://localhost:8081/customer-cookie-portal/*" "/customer-cookie-portal/*"
], ],
"secret": "password" "secret": "password"
}, },
@ -141,10 +141,10 @@
"name": "customer-portal-js", "name": "customer-portal-js",
"enabled": true, "enabled": true,
"publicClient": true, "publicClient": true,
"adminUrl": "http://localhost:8081/customer-portal-js", "adminUrl": "/customer-portal-js",
"baseUrl": "http://localhost:8081/customer-portal-js", "baseUrl": "/customer-portal-js",
"redirectUris": [ "redirectUris": [
"http://localhost:8080/customer-portal-js/*" "/customer-portal-js/*"
] ]
}, },
{ {
@ -159,21 +159,21 @@
{ {
"name": "product-portal", "name": "product-portal",
"enabled": true, "enabled": true,
"adminUrl": "http://localhost:8081/product-portal", "adminUrl": "/product-portal",
"baseUrl": "http://localhost:8081/product-portal", "baseUrl": "/product-portal",
"redirectUris": [ "redirectUris": [
"http://localhost:8081/product-portal/*" "/product-portal/*"
], ],
"secret": "password" "secret": "password"
}, },
{ {
"name": "secure-portal", "name": "secure-portal",
"enabled": true, "enabled": true,
"adminUrl": "http://localhost:8081/secure-portal", "adminUrl": "/secure-portal",
"baseUrl": "http://localhost:8081/secure-portal", "baseUrl": "/secure-portal",
"clientAuthenticatorType": "client-jwt", "clientAuthenticatorType": "client-jwt",
"redirectUris": [ "redirectUris": [
"http://localhost:8081/secure-portal/*" "/secure-portal/*"
], ],
"attributes": { "attributes": {
"jwt.credential.certificate": "MIICnTC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EBBQADggEPADCCAQoCggEBAIUjjgv+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", "name": "session-portal",
"enabled": true, "enabled": true,
"adminUrl": "http://localhost:8081/session-portal", "adminUrl": "/session-portal",
"baseUrl": "http://localhost:8081/session-portal", "baseUrl": "/session-portal",
"redirectUris": [ "redirectUris": [
"http://localhost:8081/session-portal/*" "/session-portal/*"
], ],
"secret": "password" "secret": "password"
}, },
{ {
"name": "input-portal", "name": "input-portal",
"enabled": true, "enabled": true,
"adminUrl": "http://localhost:8081/input-portal", "adminUrl": "/input-portal",
"baseUrl": "http://localhost:8081/input-portal", "baseUrl": "/input-portal",
"redirectUris": [ "redirectUris": [
"http://localhost:8081/input-portal/*" "/input-portal/*"
], ],
"secret": "password" "secret": "password"
} }
@ -205,8 +205,8 @@
"name": "third-party", "name": "third-party",
"enabled": true, "enabled": true,
"redirectUris": [ "redirectUris": [
"http://localhost:8081/oauth-client/*", "/oauth-client/*",
"http://localhost:8081/oauth-client-cdi/*" "/oauth-client-cdi/*"
], ],
"secret": "password" "secret": "password"
} }