Search in sources :

Example 1 with HttpClientAdapterException

use of org.keycloak.adapters.HttpClientAdapterException in project keycloak by keycloak.

the class JWKPublicKeyLocator method sendRequest.

private void sendRequest(KeycloakDeployment deployment) {
    if (log.isTraceEnabled()) {
        log.trace("Going to send request to retrieve new set of realm public keys for client " + deployment.getResourceName());
    }
    HttpGet getMethod = new HttpGet(deployment.getJwksUrl());
    try {
        JSONWebKeySet jwks = HttpAdapterUtils.sendJsonHttpRequest(deployment, getMethod, JSONWebKeySet.class);
        Map<String, PublicKey> publicKeys = JWKSUtils.getKeysForUse(jwks, JWK.Use.SIG);
        if (log.isDebugEnabled()) {
            log.debug("Realm public keys successfully retrieved for client " + deployment.getResourceName() + ". New kids: " + publicKeys.keySet().toString());
        }
        // Update current keys
        currentKeys.clear();
        currentKeys.putAll(publicKeys);
    } catch (HttpClientAdapterException e) {
        log.error("Error when sending request to retrieve realm keys", e);
    }
}
Also used : JSONWebKeySet(org.keycloak.jose.jwk.JSONWebKeySet) PublicKey(java.security.PublicKey) HttpGet(org.apache.http.client.methods.HttpGet) HttpClientAdapterException(org.keycloak.adapters.HttpClientAdapterException)

Aggregations

PublicKey (java.security.PublicKey)1 HttpGet (org.apache.http.client.methods.HttpGet)1 HttpClientAdapterException (org.keycloak.adapters.HttpClientAdapterException)1 JSONWebKeySet (org.keycloak.jose.jwk.JSONWebKeySet)1