Skip to content

Commit 1524b1d

Browse files
authored
Don't cache key resolutions when cleanup interval is zero (#94)
1 parent 4779a86 commit 1524b1d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tokens/src/main/java/io/scalecube/security/tokens/jwt/JwtTokenResolverImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ public Mono<Map<String, Object>> resolve(String token) {
114114
}
115115

116116
private Mono<Key> findKey(String kid, AtomicReference<Mono<Key>> computedValueHolder) {
117+
if (cleanupInterval.isZero()) {
118+
return Mono.defer(() -> keyProvider.findKey(kid)).cache();
119+
}
120+
117121
return keyResolutions.computeIfAbsent(
118122
kid,
119123
(kid1) -> {

0 commit comments

Comments
 (0)