public abstract class AccessTokenProvider extends Object
In other words, this is is a token cache that fetches tokens when requested, if the cached token has expired.
| Modifier and Type | Field and Description |
|---|---|
protected AzureADToken |
token |
| Constructor and Description |
|---|
AccessTokenProvider() |
| Modifier and Type | Method and Description |
|---|---|
AzureADToken |
getToken()
returns the
AzureADToken cached (or retrieved) by this instance. |
protected boolean |
isTokenAboutToExpire()
Checks if the token is about to expire in the next 5 minutes.
|
protected abstract AzureADToken |
refreshToken()
the method to fetch the access token.
|
protected AzureADToken token
public AzureADToken getToken() throws IOException
AzureADToken cached (or retrieved) by this instance.AzureADToken containing the access tokenIOException - if there is an error fetching the tokenprotected abstract AzureADToken refreshToken() throws IOException
This method will be called initially, and then once when the token is about to expire.
AzureADToken containing the access tokenIOException - if there is an error fetching the tokenprotected boolean isTokenAboutToExpire()
Copyright © 2020 Microsoft Corporation. All rights reserved.