commit
2da9986717
1 changed files with 18 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue