use of com.venafi.vcert.sdk.connectors.ConnectorException.FailedToRevokeTokenException in project vcert-java by Venafi.
the class TppTokenConnectorTest method revokeAccessTokenInvalid.
@Test
@DisplayName("Revoke access token invalid")
void revokeAccessTokenInvalid() {
final Request request = Request.create(Request.HttpMethod.GET, "", new HashMap<String, Collection<String>>(), null);
final Response response = Response.builder().status(202).request(request).build();
when(tpp.revokeToken(eq(HEADER_AUTHORIZATION))).thenReturn(response);
Throwable throwable = assertThrows(VCertException.class, () -> classUnderTest.revokeAccessToken());
assertThat(throwable instanceof FailedToRevokeTokenException);
}
use of com.venafi.vcert.sdk.connectors.ConnectorException.FailedToRevokeTokenException in project vcert-java by Venafi.
the class TppTokenConnector method revokeAccessToken.
@Override
public int revokeAccessToken() throws VCertException {
// "Bearer "+accessToken;
String requestHeader = getAuthHeaderValue();
Response response = tpp.revokeToken(requestHeader);
if (response.status() == 200) {
return response.status();
} else {
throw new FailedToRevokeTokenException(response.reason());
}
}
Aggregations