use of io.airlift.http.client.StringResponseHandler.StringResponse in project airlift by airlift.
the class JwksService method fetchKeys.
private Map<String, PublicKey> fetchKeys() {
Request request = prepareGet().setUri(address).build();
StringResponse response;
try {
response = httpClient.execute(request, createStringResponseHandler());
} catch (RuntimeException e) {
throw new RuntimeException("Error reading JWKS keys from " + address, e);
}
if (response.getStatusCode() != 200) {
throw new RuntimeException("Unexpected response code " + response.getStatusCode() + " from JWKS service at " + address);
}
try {
return decodeKeys(response.getBody());
} catch (RuntimeException e) {
throw new RuntimeException("Unable to decode JWKS response from " + address, e);
}
}
Aggregations