Class CaffeineCacheAccessTokenResolver
- java.lang.Object
-
- org.forgerock.openig.filter.oauth2.CaffeineCacheAccessTokenResolver
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.forgerock.http.oauth2.AccessTokenResolver
public class CaffeineCacheAccessTokenResolver extends Object implements org.forgerock.http.oauth2.AccessTokenResolver, Closeable
ACaffeineCacheAccessTokenResolver
is a delegatingAccessTokenResolver
that uses a write-throughCaffeine
to enable fastAccessTokenInfo
resolution.{ "type": "CacheAccessTokenResolver", "config": { "delegate" : AccessTokenResolver [REQUIRED] "enabled" : expression [OPTIONAL - default to true.] "defaultTimeout" : duration [OPTIONAL - default to 1 minute.] "executor" : executor [OPTIONAL - By default, {@link ForkJoinPool#commonPool()} is used.] "maximumSize" : expression(long) [OPTIONAL - Sets the maximum size of the cache.] "maximumTimeToCache" : duration [OPTIONAL - "zero" and "unlimited" are not acceptable values.] } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CaffeineCacheAccessTokenResolver.Heaplet
Creates and initializes anCaffeineCacheAccessTokenResolver
in the heap environment.
-
Constructor Summary
Constructors Constructor Description CaffeineCacheAccessTokenResolver(com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine, org.forgerock.http.oauth2.AccessTokenResolver delegate, Clock clock, Duration defaultTimeout, Duration maximumTimeout)
Builds aCaffeineCacheAccessTokenResolver
delegating to the givenAccessTokenResolver
using the given (pre-configured) cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Promise<org.forgerock.http.oauth2.AccessTokenInfo,org.forgerock.http.oauth2.AccessTokenException>
resolve(Context context, String token)
-
-
-
Constructor Detail
-
CaffeineCacheAccessTokenResolver
public CaffeineCacheAccessTokenResolver(com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine, org.forgerock.http.oauth2.AccessTokenResolver delegate, Clock clock, Duration defaultTimeout, Duration maximumTimeout)
Builds aCaffeineCacheAccessTokenResolver
delegating to the givenAccessTokenResolver
using the given (pre-configured) cache.- Parameters:
caffeine
- The caffeine cache to use. Notnull
.delegate
- The resolver to use. Notnull
.clock
- A clock providing access to the current instant, date and time using a time-zone, notnull
.defaultTimeout
- The default duration for which to cache AM access tokens. If an AM access token provides a valid expiresAt value to specify the time until which the access token remains valid, IG uses that value or the maxTimeout. Notnull
.maximumTimeout
- The maximum duration for which to cache AM access tokens. If the expiresAt value provided by the AM access token is after the current time plus the maxTimeout, IG uses the maxTimeout. Can benull
.
-
-
Method Detail
-
resolve
public Promise<org.forgerock.http.oauth2.AccessTokenInfo,org.forgerock.http.oauth2.AccessTokenException> resolve(Context context, String token)
- Specified by:
resolve
in interfaceorg.forgerock.http.oauth2.AccessTokenResolver
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-