CreateTokenResponse createTokenResponse;
try {
createTokenResponse = send(createTokenRequest);
} catch (ValidationConstraintViolationException vcve) {
throw new AuthorizationException(vcve);
}
HttpStatus status = HttpStatus.getStatus(createTokenResponse.getStatusCode());
if (status.isError()) {
if (status.equals(HttpStatus.Unauthorized)) {
throw new AuthorizationException(HttpStatus.Unauthorized.toString());
} else {
throw new CommunicationErrorException(status);
}
}