From 5ddbb7c060af8bc2389d1869bfc147b4f1d5fe20 Mon Sep 17 00:00:00 2001 From: Mike Halma <58170926+mikehalmamoj@users.noreply.github.com> Date: Thu, 12 Mar 2020 08:39:07 +0000 Subject: [PATCH] DT-609 Fix caching of JWK Set (#416) This is a short term fix until we implement RemoteJwkSet. --- src/main/java/net/syscon/elite/web/config/JwkClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/syscon/elite/web/config/JwkClient.java b/src/main/java/net/syscon/elite/web/config/JwkClient.java index a487d57121..36b99c3d8c 100644 --- a/src/main/java/net/syscon/elite/web/config/JwkClient.java +++ b/src/main/java/net/syscon/elite/web/config/JwkClient.java @@ -34,7 +34,7 @@ public JwkClient(@Value("${spring.security.oauth2.resourceserver.jwt.jwk-set-uri public PublicKey getPublicKeyForKeyId(final String keyId) { return publicKeysById .map(keys -> keys.get(keyId)) - .orElse(retrieveKeysAndFind(keyId)); + .orElseGet(() -> retrieveKeysAndFind(keyId)); } private PublicKey retrieveKeysAndFind(final String keyId) {