Package com.azure.core.credential
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 Summary
Constructors Constructor Description SimpleTokenCache(Supplier<Mono<AccessToken>> tokenSupplier)
Creates an instance of RefreshableTokenCredential with default scheme "Bearer".
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<AccessToken>
getToken()
Asynchronously get a token from either the cache or replenish the cache with a new token.
-
-
-
Constructor Detail
-
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 Detail
-
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
-
-