Class CaffeineCacheAccessTokenResolver.Builder
- java.lang.Object
-
- org.forgerock.openig.filter.oauth2.CaffeineCacheAccessTokenResolver.Builder
-
- Enclosing class:
- CaffeineCacheAccessTokenResolver
public static final class CaffeineCacheAccessTokenResolver.Builder extends Object
Builder ofCaffeineCacheAccessTokenResolver
.
-
-
Constructor Summary
Constructors Constructor Description Builder(com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine, AccessTokenResolver delegate, Clock clock, Duration defaultTimeout, Duration maximumTimeout)
Creates aCaffeineCacheAccessTokenResolver.Builder
delegating to the givenAccessTokenResolver
using the given (pre-configured) cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CaffeineCacheAccessTokenResolver
build()
Returns a newCaffeineCacheAccessTokenResolver
instance.com.github.benmanes.caffeine.cache.AsyncCache<String,AccessTokenInfo>
cache()
Bind the various cache invalidation callbacks and return a cache based on the properties set on the builder.CaffeineCacheAccessTokenResolver.Builder
disconnectionStrategy(DisconnectionStrategy disconnectionStrategy)
Bind aDisconnectionStrategy
instance to this builder.CaffeineCacheAccessTokenResolver.Builder
notificationService(NotificationService notificationService)
Bind aNotificationService
instance to this builder.
-
-
-
Constructor Detail
-
Builder
public Builder(com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine, AccessTokenResolver delegate, Clock clock, Duration defaultTimeout, Duration maximumTimeout)
Creates aCaffeineCacheAccessTokenResolver.Builder
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
-
notificationService
public CaffeineCacheAccessTokenResolver.Builder notificationService(NotificationService notificationService)
Bind aNotificationService
instance to this builder.- Parameters:
notificationService
- the notificationService to be bound to this builder- Returns:
- this Builder
-
disconnectionStrategy
public CaffeineCacheAccessTokenResolver.Builder disconnectionStrategy(DisconnectionStrategy disconnectionStrategy)
Bind aDisconnectionStrategy
instance to this builder.- Parameters:
disconnectionStrategy
- the disconnectionStrategy to be bound to this builder- Returns:
- this Builder
-
cache
public com.github.benmanes.caffeine.cache.AsyncCache<String,AccessTokenInfo> cache()
Bind the various cache invalidation callbacks and return a cache based on the properties set on the builder.- Returns:
- the
AsyncCache
to be used when caching anAccessTokenInfo
against a particular token.
-
build
public CaffeineCacheAccessTokenResolver build()
Returns a newCaffeineCacheAccessTokenResolver
instance.- Returns:
- a new
CaffeineCacheAccessTokenResolver
instance.
-
-