Package org.entur.jwt.client
Class AbstractAccessTokenProvidersBuilder<B extends AbstractAccessTokenProvidersBuilder<B>>
java.lang.Object
org.entur.jwt.client.AbstractAccessTokenProvidersBuilder<B>
- Direct Known Subclasses:
AccessTokenProviderBuilder
public abstract class AbstractAccessTokenProvidersBuilder<B extends AbstractAccessTokenProvidersBuilder<B>>
extends Object
AccessTokenProvider builder scaffold.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AccessTokenProviderprotected booleanprotected booleanprotected TimeUnitminimum time to live, when returned from the cacheprotected longprotected booleanprotected intprotected booleanprotected TimeUnitprotected longprotected longprotected TimeUnitprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionAbstractAccessTokenProvidersBuilder(AccessTokenProvider accessTokenProvider) Wrap a specific AccessTokenProvider. -
Method Summary
Modifier and TypeMethodDescriptionbuild()protected AccessTokenProviderbuild(AccessTokenProvider provider) cached(boolean cached) Toggle the cache of AccessToken.cached(long minimumTimeToLiveLeft, TimeUnit minimumTimeToLiveLeftUnit, long refreshExpiresIn, TimeUnit refreshExpiresInUnit) Enable the cache specifying how much time should left on the token when returned (minimal time to live) by the cache and maximum wait (blocking) time for cache refresh.health(boolean enabled) Toggle the health status of AccessToken.preemptiveCacheRefresh(boolean preemptive) Enable the preemptive cache.preemptiveCacheRefresh(long timeout, TimeUnit unit, int constraint, boolean eager) Enable the preemptive cache refresh.retrying(boolean retrying)
-
Field Details
-
accessTokenProvider
-
cached
protected boolean cached -
minimumTimeToLiveUnit
minimum time to live, when returned from the cache -
minimumTimeToLiveUnits
protected long minimumTimeToLiveUnits -
refreshExpiresUnit
-
refreshExpiresIn
protected long refreshExpiresIn -
preemptiveRefresh
protected boolean preemptiveRefresh -
preemptiveRefreshTimeUnit
-
preemptiveRefreshTimeUnits
protected long preemptiveRefreshTimeUnits -
preemptiveRefreshEager
protected boolean preemptiveRefreshEager -
preemptiveRefreshConstraint
protected int preemptiveRefreshConstraint -
health
protected boolean health -
retrying
protected boolean retrying
-
-
Constructor Details
-
AbstractAccessTokenProvidersBuilder
Wrap a specific AccessTokenProvider. Access to this instance will be cached according to the configuration of this builder.- Parameters:
accessTokenProvider- root accessTokenProvider
-
-
Method Details
-
cached
Toggle the cache of AccessToken. By default the provider will use cache.- Parameters:
cached- if the provider should cache access-tokens- Returns:
- the builder
-
health
Toggle the health status of AccessToken. By default this option is enabled.- Parameters:
enabled- true if the health status provider should be enabled- Returns:
- the builder
-
cached
public B cached(long minimumTimeToLiveLeft, TimeUnit minimumTimeToLiveLeftUnit, long refreshExpiresIn, TimeUnit refreshExpiresInUnit) Enable the cache specifying how much time should left on the token when returned (minimal time to live) by the cache and maximum wait (blocking) time for cache refresh.- Parameters:
minimumTimeToLiveLeft- minimum time to live unitsminimumTimeToLiveLeftUnit- minimum time to live unitsrefreshExpiresIn- cache refresh timeoutrefreshExpiresInUnit- cache refresh timeout unit- Returns:
- the builder
-
preemptiveCacheRefresh
Enable the preemptive cache refresh. This also enables caching.- Parameters:
timeout- Preemptive timeout, relative to cache time to live, i.e. "15 seconds before timeout, refresh time cached value".unit- unit of preemptive timeoutconstraint- constraint in percent, of a token's lifetime, before any preemptive refresh happenseager- preemptive refresh even if no traffic (schedule update)- Returns:
- the builder
-
preemptiveCacheRefresh
Enable the preemptive cache. This also enables caching.- Parameters:
preemptive- if true, preemptive caching is active- Returns:
- the builder
-
build
-
build
-
retrying
-