Skip to content
This repository was archived by the owner on May 31, 2022. It is now read-only.

Commit af789e0

Browse files
leomillonjgrandja
authored andcommitted
Double-checked locking when loading Jwk definitions
Fixes gh-1405
1 parent b436f74 commit af789e0

File tree

1 file changed

+4
-0
lines changed
  • spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/store/jwk

1 file changed

+4
-0
lines changed

spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/store/jwk/JwkDefinitionSource.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ JwkDefinitionHolder getDefinitionLoadIfNecessary(String keyId) {
8585
return result;
8686
}
8787
synchronized (this.jwkDefinitions) {
88+
result = this.getDefinition(keyId);
89+
if (result != null) {
90+
return result;
91+
}
8892
this.jwkDefinitions.clear();
8993
for (URL jwkSetUrl : jwkSetUrls) {
9094
this.jwkDefinitions.putAll(loadJwkDefinitions(jwkSetUrl));

0 commit comments

Comments
 (0)