use of co.cask.cdap.security.authentication.client.AccessToken in project cdap by caskdata.
the class RESTClientTest method testDeleteSuccessWithAccessToken.
@Test
public void testDeleteSuccessWithAccessToken() throws Exception {
URL url = getBaseURI().resolve("/api/testDeleteAuth").toURL();
HttpRequest request = HttpRequest.delete(url).build();
HttpResponse response = restClient.execute(request, new AccessToken(ACCESS_TOKEN, 82000L, "Bearer"));
verifyResponse(response, only(200), any(), only("Access token received: " + ACCESS_TOKEN));
}
use of co.cask.cdap.security.authentication.client.AccessToken in project cdap by caskdata.
the class RESTClientTest method testPutForbidden.
@Test(expected = UnauthorizedException.class)
public void testPutForbidden() throws Exception {
URL url = getBaseURI().resolve("/api/testPutForbidden").toURL();
HttpRequest request = HttpRequest.put(url).build();
restClient.execute(request, new AccessToken("Unknown", 82000L, "Bearer"));
}
use of co.cask.cdap.security.authentication.client.AccessToken in project cdap by caskdata.
the class RESTClientTest method testGetForbidden.
@Test(expected = UnauthorizedException.class)
public void testGetForbidden() throws Exception {
URL url = getBaseURI().resolve("/api/testGetForbidden").toURL();
HttpRequest request = HttpRequest.get(url).build();
restClient.execute(request, new AccessToken("Unknown", 82000L, "Bearer"));
}
use of co.cask.cdap.security.authentication.client.AccessToken in project cdap by caskdata.
the class RESTClientTest method testPutUnauthorizedWithAccessToken.
@Test(expected = UnauthenticatedException.class)
public void testPutUnauthorizedWithAccessToken() throws Exception {
URL url = getBaseURI().resolve("/api/testPutAuth").toURL();
HttpRequest request = HttpRequest.put(url).build();
restClient.execute(request, new AccessToken("Unknown", 82000L, "Bearer"));
}
use of co.cask.cdap.security.authentication.client.AccessToken in project cdap by caskdata.
the class RESTClientTest method testPostUnauthorizedWithAccessToken.
@Test(expected = UnauthenticatedException.class)
public void testPostUnauthorizedWithAccessToken() throws Exception {
URL url = getBaseURI().resolve("/api/testPostAuth").toURL();
HttpRequest request = HttpRequest.post(url).build();
restClient.execute(request, new AccessToken("Unknown", 82000L, "Bearer"));
}
Aggregations