diff --git a/testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/index.html b/testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/index.html index ed3da59e0d..516ddc145f 100755 --- a/testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/index.html +++ b/testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/index.html @@ -97,6 +97,7 @@ +
{{headers}}
diff --git a/testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/js/app.js b/testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/js/app.js index e09b058244..eb760a987d 100755 --- a/testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/js/app.js +++ b/testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/js/app.js @@ -73,9 +73,9 @@ module.controller('GlobalCtrl', function($scope, $http) { $scope.realm = []; $scope.version = []; $scope.reloadData = function() { - $http.get(getAppServerUrl("localhost-db") + "/cors-database/products").success(function(data) { + $http.get(getAppServerUrl("localhost-db") + "/cors-database/products").success(function(data, status, headers, config) { $scope.products = angular.fromJson(data); - + $scope.headers = headers(); }); }; diff --git a/testsuite/integration-arquillian/test-apps/cors/database-service/src/main/java/org/keycloak/example/oauth/ProductService.java b/testsuite/integration-arquillian/test-apps/cors/database-service/src/main/java/org/keycloak/example/oauth/ProductService.java index 69cb58feaf..321f1effec 100755 --- a/testsuite/integration-arquillian/test-apps/cors/database-service/src/main/java/org/keycloak/example/oauth/ProductService.java +++ b/testsuite/integration-arquillian/test-apps/cors/database-service/src/main/java/org/keycloak/example/oauth/ProductService.java @@ -19,9 +19,11 @@ package org.keycloak.example.oauth; import org.jboss.resteasy.annotations.cache.NoCache; +import javax.servlet.http.HttpServletResponse; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; import java.util.ArrayList; import java.util.List; @@ -31,6 +33,10 @@ import java.util.List; */ @Path("products") public class ProductService { + + @Context + private HttpServletResponse response; + @GET @Produces("application/json") @NoCache @@ -39,6 +45,8 @@ public class ProductService { rtn.add("iphone"); rtn.add("ipad"); rtn.add("ipod"); + + response.addHeader("X-Custom1", "some-value"); return rtn; } } diff --git a/testsuite/integration-arquillian/test-apps/cors/database-service/src/main/webapp/WEB-INF/keycloak.json b/testsuite/integration-arquillian/test-apps/cors/database-service/src/main/webapp/WEB-INF/keycloak.json index 493176dcac..993d69c6d5 100755 --- a/testsuite/integration-arquillian/test-apps/cors/database-service/src/main/webapp/WEB-INF/keycloak.json +++ b/testsuite/integration-arquillian/test-apps/cors/database-service/src/main/webapp/WEB-INF/keycloak.json @@ -5,5 +5,6 @@ "auth-server-url": "http://localhost-auth:8180/auth", "bearer-only" : true, "ssl-required": "external", - "enable-cors": true + "enable-cors": true, + "cors-exposed-headers": "X-Custom1" } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/AngularCorsProductTestApp.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/AngularCorsProductTestApp.java index f49023ebe5..cb84089f0f 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/AngularCorsProductTestApp.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/AngularCorsProductTestApp.java @@ -66,6 +66,8 @@ public class AngularCorsProductTestApp extends AbstractPageWithInjectedUrl { @FindBy(id = "output") private WebElement outputArea; + @FindBy(id = "headers") + private WebElement headers; public void reloadData() { reloadDataButton.click(); @@ -99,5 +101,9 @@ public class AngularCorsProductTestApp extends AbstractPageWithInjectedUrl { return outputArea; } + public WebElement getHeaders() { + return headers; + } + } \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/AbstractCorsExampleAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/AbstractCorsExampleAdapterTest.java index 43981645aa..83a34c72d9 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/AbstractCorsExampleAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/AbstractCorsExampleAdapterTest.java @@ -94,6 +94,7 @@ public abstract class AbstractCorsExampleAdapterTest extends AbstractExampleAdap waitUntilElement(angularCorsProductPage.getOutput()).text().contains("iphone"); waitUntilElement(angularCorsProductPage.getOutput()).text().contains("ipad"); waitUntilElement(angularCorsProductPage.getOutput()).text().contains("ipod"); + waitUntilElement(angularCorsProductPage.getHeaders()).text().contains("\"x-custom1\":\"some-value\""); angularCorsProductPage.loadRoles(); waitUntilElement(angularCorsProductPage.getOutput()).text().contains("user");