Class CachedTokenRefresher.Builder<TokenT extends SdkToken>

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • staleDuration

        public CachedTokenRefresher.Builder staleDuration​(Duration staleDuration)
        Parameters:
        staleDuration - The time before which the token is marked as stale to indicate it is time to fetch a fresh token.
        Returns:
      • prefetchTime

        public CachedTokenRefresher.Builder prefetchTime​(Duration prefetchTime)
        Configure the amount of time, relative to SSO session token expiration, that the cached credentials are considered close to stale and should be updated. See asyncRefreshEnabled.

        By default, this is 5 minutes.

      • asyncRefreshEnabled

        public CachedTokenRefresher.Builder asyncRefreshEnabled​(Boolean asyncRefreshEnabled)
        Configure whether this refresher should fetch tokens asynchronously in the background. If this is true, threads are less likely to block when CachedTokenRefresher.refreshIfStaleAndFetch() ()} is called, but additional resources are used to maintain the provider.

        By default, this is disabled.

      • exceptionHandler

        public CachedTokenRefresher.Builder exceptionHandler​(Function<SdkException,​TokenT> exceptionHandler)
        Parameters:
        exceptionHandler - Handler which takes action when a Runtime exception occurs while fetching a token. Handler can return a previously stored token or throw back the exception.
        Returns: