Class SimpleTokenCache

java.lang.Object
com.azure.core.credential.SimpleTokenCache

public class SimpleTokenCache extends Object
A token cache that supports caching a token and refreshing it.
  • Constructor Details

    • SimpleTokenCache

      public SimpleTokenCache(Supplier<Mono<AccessToken>> tokenSupplier)
      Creates an instance of RefreshableTokenCredential with default scheme "Bearer".
      Parameters:
      tokenSupplier - a method to get a new token
  • Method Details

    • getToken

      public Mono<AccessToken> getToken()
      Asynchronously get a token from either the cache or replenish the cache with a new token.
      Returns:
      a Publisher that emits an AccessToken