File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
services/localega-tsd-proxy/src/main
java/no/elixir/fega/ltp/config Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 1313@ Configuration
1414public class JwtDecoderConfig {
1515
16+ private final int maxCacheSize ;
17+ private final long timeToLive ;
18+ private final TimeUnit timeUnit ;
19+ private final String aaiBase ;
20+
21+ public JwtDecoderConfig (
22+ @ Value ("${jwk-cache.max-size}" ) int maxCacheSize ,
23+ @ Value ("${jwk-cache.duration}" ) long timeToLive ,
24+ @ Value ("${jwk-cache.time-unit}" ) TimeUnit timeUnit ,
25+ @ Value ("${aai.service-base-url}" ) String aaiBase ) {
26+ this .maxCacheSize = maxCacheSize ;
27+ this .timeToLive = timeToLive ;
28+ this .timeUnit = timeUnit ;
29+ this .aaiBase = aaiBase ;
30+ }
31+
1632 @ Bean
17- public JwtDecoder jwtDecoder (@ Value ( "${aai.service-base-url}" ) String aaiBase ) {
33+ public JwtDecoder jwtDecoder () {
1834
1935 com .github .benmanes .caffeine .cache .Cache <Object , Object > nativeCache =
20- Caffeine .newBuilder ().expireAfterWrite (60 , TimeUnit .MINUTES ).maximumSize (100 ).build ();
36+ Caffeine .newBuilder ()
37+ .expireAfterWrite (timeToLive , timeUnit )
38+ .maximumSize (maxCacheSize )
39+ .build ();
2140
2241 Cache jwkCache = new CaffeineCache ("jwkCache" , nativeCache );
2342
Original file line number Diff line number Diff line change @@ -111,3 +111,8 @@ logging:
111111 org.springframework.web.servlet.DispatcherServlet : ${APP_LOG_LEVEL:INFO}
112112 com.fasterxml.jackson : ${APP_LOG_LEVEL:INFO}
113113 root : ${APP_LOG_LEVEL:INFO}
114+
115+ jwk-cache :
116+ duration : 60
117+ time-unit : minutes
118+ max-size : 100
You can’t perform that action at this time.
0 commit comments