use of io.cdap.cdap.security.authentication.client.AccessToken in project cdap by caskdata.
the class RESTClientTest method testGetUnauthorizedWithAccessToken.
@Test(expected = UnauthenticatedException.class)
public void testGetUnauthorizedWithAccessToken() throws Exception {
URL url = getBaseURI().resolve("/api/testGetAuth").toURL();
HttpRequest request = HttpRequest.get(url).build();
restClient.execute(request, new AccessToken("Unknown", 82000L, "Bearer"));
}
use of io.cdap.cdap.security.authentication.client.AccessToken in project cdap by caskdata.
the class RESTClientTest method testPostForbidden.
@Test(expected = UnauthorizedException.class)
public void testPostForbidden() throws Exception {
URL url = getBaseURI().resolve("/api/testPostForbidden").toURL();
HttpRequest request = HttpRequest.post(url).build();
restClient.execute(request, new AccessToken("Unknown", 82000L, "Bearer"));
}
use of io.cdap.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 io.cdap.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 io.cdap.cdap.security.authentication.client.AccessToken in project cdap by caskdata.
the class RESTClientTest method testDeleteUnauthorizedWithAccessToken.
@Test(expected = UnauthenticatedException.class)
public void testDeleteUnauthorizedWithAccessToken() throws Exception {
URL url = getBaseURI().resolve("/api/testDeleteAuth").toURL();
HttpRequest request = HttpRequest.delete(url).build();
restClient.execute(request, new AccessToken("Unknown", 82000L, "Bearer"));
}
Aggregations