Class CommunicationTokenRefreshOptions
java.lang.Object
com.azure.android.communication.common.CommunicationTokenRefreshOptions
Options for refreshing CommunicationTokenCredential
This class is used to define how CommunicationTokenCredential should be refreshed
-
Constructor Summary
ConstructorsConstructorDescriptionCommunicationTokenRefreshOptions
(Callable<String> tokenRefresher, boolean refreshProactively) Creates aCommunicationTokenRefreshOptions
objectCommunicationTokenRefreshOptions
(Callable<String> tokenRefresher, boolean refreshProactively, String initialToken) Creates aCommunicationTokenRefreshOptions
object -
Method Summary
Modifier and TypeMethodDescriptionboolean
-
Constructor Details
-
CommunicationTokenRefreshOptions
public CommunicationTokenRefreshOptions(Callable<String> tokenRefresher, boolean refreshProactively) Creates aCommunicationTokenRefreshOptions
objectAccess token will be fetched on demand and may optionally enable proactive refreshing
- Parameters:
tokenRefresher
- the token refresher to provide capacity to fetch fresh token, cannot be nullrefreshProactively
- when set to true, turn on proactive fetching to call tokenRefresher before token expiry by minutes set with setCallbackOffsetMinutes or default value of two minutes
-
CommunicationTokenRefreshOptions
public CommunicationTokenRefreshOptions(Callable<String> tokenRefresher, boolean refreshProactively, String initialToken) Creates aCommunicationTokenRefreshOptions
objectA valid token is supplied and may optionally enable proactive refreshing
- Parameters:
tokenRefresher
- the token refresher to provide capacity to fetch fresh token, cannot be nullrefreshProactively
- when set to true, turn on proactive fetching to call tokenRefresher before token expiry by minutes set with setCallbackOffsetMinutes or default value of two minutesinitialToken
- the serialized JWT token, cannot be null- Throws:
IllegalArgumentException
- if the parameter tokenRefresher or initialToken is null.
-
-
Method Details
-
getTokenRefresher
- Returns:
- the token refresher to provide capacity to fetch fresh token
-
isRefreshProactively
public boolean isRefreshProactively()- Returns:
- whether or not to refresh token proactively
-
getInitialToken
- Returns:
- the serialized JWT token
-