Skip to content

Commit a3a8f23

Browse files
committed
Remove Deprecated Usages of RemoteJWKSet
close gh-16251
1 parent fa288c2 commit a3a8f23

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,12 @@ public List<JWK> get(JWKSelector jwkSelector, SecurityContext context) throws Ke
457457
return Collections.emptyList();
458458
}
459459
synchronized (this) {
460-
jwkSet = fetchJWKSet();
461-
this.jwkSetCache.put(jwkSet);
460+
if(jwkSet == this.jwkSetCache.get()) {
461+
jwkSet = fetchJWKSet();
462+
this.jwkSetCache.put(jwkSet);
463+
} else {
464+
jwkSet = this.jwkSetCache.get();
465+
}
462466
}
463467
if(jwkSet == null) {
464468
return Collections.emptyList();

0 commit comments

Comments
 (0)