diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientRedirectTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientRedirectTest.java index 42ab6c26e6..1c232b6250 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientRedirectTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientRedirectTest.java @@ -18,11 +18,16 @@ package org.keycloak.testsuite.client; import org.junit.Test; +import org.keycloak.OAuth2Constants; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.testsuite.TestRealmKeycloakTest; import org.keycloak.testsuite.util.ClientBuilder; import org.keycloak.testsuite.util.RealmBuilder; +import javax.ws.rs.client.Client; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.Response; + import static org.junit.Assert.assertEquals; /** @@ -55,4 +60,17 @@ public class ClientRedirectTest extends TestRealmKeycloakTest { driver.get(getAuthServerRoot().toString() + "realms/test/clients/account/redirect"); assertEquals(getAuthServerRoot().toString() + "realms/test/account", driver.getCurrentUrl()); } + + @Test + public void testRedirectStatusCode() { + oauth.doLogin("test-user@localhost", "password"); + String code = oauth.getCurrentQuery().get(OAuth2Constants.CODE); + String token = oauth.doAccessTokenRequest(code, "password").getAccessToken(); + + Client client = javax.ws.rs.client.ClientBuilder.newClient(); + String redirectUrl = getAuthServerRoot().toString() + "realms/test/clients/launchpad-test/redirect"; + Response response = client.target(redirectUrl).request().header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); + assertEquals(303, response.getStatus()); + client.close(); + } }