KEYCLOAK-3671
This commit is contained in:
parent
33cd261d83
commit
b2d48c86a6
1 changed files with 18 additions and 0 deletions
|
@ -18,11 +18,16 @@
|
||||||
package org.keycloak.testsuite.client;
|
package org.keycloak.testsuite.client;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.TestRealmKeycloakTest;
|
import org.keycloak.testsuite.TestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.util.ClientBuilder;
|
import org.keycloak.testsuite.util.ClientBuilder;
|
||||||
import org.keycloak.testsuite.util.RealmBuilder;
|
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;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,4 +60,17 @@ public class ClientRedirectTest extends TestRealmKeycloakTest {
|
||||||
driver.get(getAuthServerRoot().toString() + "realms/test/clients/account/redirect");
|
driver.get(getAuthServerRoot().toString() + "realms/test/clients/account/redirect");
|
||||||
assertEquals(getAuthServerRoot().toString() + "realms/test/account", driver.getCurrentUrl());
|
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