38             final Pair<String, String> mapKey = 
new Pair<>(jwkSetUri, keyId);
    40             RSAPublicKey cachedKey = 
cache.getIfPresent(mapKey);
    41             if (cachedKey != null) {
    42                 LOG.debug(
"Taken public key from cache, mapKey: " + mapKey);
    46             RSAPublicKey publicKey = null;
    48             JwkClient jwkClient = 
new JwkClient(jwkSetUri);
    49             jwkClient.setExecutor(
new ApacheHttpClient4Executor(CoreUtils.createHttpClientTrustAll()));
    50             JwkResponse jwkResponse = jwkClient.exec();
    51             if (jwkResponse != null && jwkResponse.getStatus() == 200) {
    52                 PublicKey pk = jwkResponse.getPublicKey(keyId);
    53                 if (pk instanceof RSAPublicKey) {
    54                     publicKey = (RSAPublicKey) pk;
    55                     cache.put(mapKey, publicKey);
    60         } 
catch (Exception e) {
    61             LOG.error(
"Failed to fetch public key.", e);
    62             throw new RuntimeException(
"Failed to fetch public key.", e);
 final Cache< Pair< String, String >, RSAPublicKey > cache
Definition: PublicOpKeyService.java:26
 
static final Logger LOG
Definition: PublicOpKeyService.java:24