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.Builderdelegating to the givenAccessTokenResolverusing the given (pre-configured) cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CaffeineCacheAccessTokenResolverbuild()Returns a newCaffeineCacheAccessTokenResolverinstance.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.BuilderdisconnectionStrategy(DisconnectionStrategy disconnectionStrategy)Bind aDisconnectionStrategyinstance to this builder.CaffeineCacheAccessTokenResolver.BuildernotificationService(NotificationService notificationService)Bind aNotificationServiceinstance 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.Builderdelegating to the givenAccessTokenResolverusing 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 aNotificationServiceinstance to this builder.- Parameters:
notificationService- the notificationService to be bound to this builder- Returns:
- this Builder
-
disconnectionStrategy
public CaffeineCacheAccessTokenResolver.Builder disconnectionStrategy(DisconnectionStrategy disconnectionStrategy)
Bind aDisconnectionStrategyinstance 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
AsyncCacheto be used when caching anAccessTokenInfoagainst a particular token.
-
build
public CaffeineCacheAccessTokenResolver build()
Returns a newCaffeineCacheAccessTokenResolverinstance.- Returns:
- a new
CaffeineCacheAccessTokenResolverinstance.
-
-