CachingTokenSource constructor

CachingTokenSource(
  1. TokenSourceConfigurable _wrapped, {
  2. TokenStore? store,
  3. TokenValidator? validator,
})

Initialize a caching wrapper around any token source.

  • Parameters:
    • wrapped: The underlying token source to wrap and cache
    • store: The store implementation to use for caching (defaults to in-memory store)
    • validator: A function to determine if cached credentials are still valid (defaults to JWT expiration check)

Implementation

CachingTokenSource(
  this._wrapped, {
  TokenStore? store,
  TokenValidator? validator,
})  : _store = store ?? InMemoryTokenStore(),
      _validator = validator ?? _defaultValidator;