Class CommunicationTokenRefreshOptions
- java.lang.Object
-
- com.azure.android.communication.common.CommunicationTokenRefreshOptions
-
public final class CommunicationTokenRefreshOptions extends java.lang.ObjectOptions for refreshing CommunicationTokenCredentialThis class is used to define how CommunicationTokenCredential should be refreshed
-
-
Constructor Summary
Constructors Constructor Description CommunicationTokenRefreshOptions(java.util.concurrent.Callable<java.lang.String> tokenRefresher)Creates a CommunicationTokenRefreshOptions objectCommunicationTokenRefreshOptions(java.util.concurrent.Callable<java.lang.String> tokenRefresher, boolean refreshProactively)Deprecated.UseCommunicationTokenRefreshOptions(Callable)instead and chain fluent settersetRefreshProactively(boolean)CommunicationTokenRefreshOptions(java.util.concurrent.Callable<java.lang.String> tokenRefresher, boolean refreshProactively, java.lang.String initialToken)Deprecated.UseCommunicationTokenRefreshOptions(Callable)instead and chain fluent settersetRefreshProactively(boolean)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetInitialToken()java.util.concurrent.Callable<java.lang.String>getTokenRefresher()booleanisRefreshProactively()CommunicationTokenRefreshOptionssetInitialToken(java.lang.String initialToken)Set the optional serialized JWT tokenCommunicationTokenRefreshOptionssetRefreshProactively(boolean refreshProactively)Set whether the token should be proactively renewed prior to its expiry or on demand.
-
-
-
Constructor Detail
-
CommunicationTokenRefreshOptions
@Deprecated public CommunicationTokenRefreshOptions(java.util.concurrent.Callable<java.lang.String> tokenRefresher, boolean refreshProactively)Deprecated.UseCommunicationTokenRefreshOptions(Callable)instead and chain fluent settersetRefreshProactively(boolean)Creates aCommunicationTokenRefreshOptionsobjectAccess 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
@Deprecated public CommunicationTokenRefreshOptions(java.util.concurrent.Callable<java.lang.String> tokenRefresher, boolean refreshProactively, java.lang.String initialToken)Deprecated.UseCommunicationTokenRefreshOptions(Callable)instead and chain fluent settersetRefreshProactively(boolean)Creates aCommunicationTokenRefreshOptionsobjectA 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:
java.lang.IllegalArgumentException- if the parameter tokenRefresher or initialToken is null.
-
CommunicationTokenRefreshOptions
public CommunicationTokenRefreshOptions(java.util.concurrent.Callable<java.lang.String> tokenRefresher)
Creates a CommunicationTokenRefreshOptions object- Parameters:
tokenRefresher- The callable token refresher that acquires a fresh token from the Communication Identity API. The returned token must be valid (its expiration date must be set in the future).
-
-
Method Detail
-
getTokenRefresher
public java.util.concurrent.Callable<java.lang.String> getTokenRefresher()
- Returns:
- The token refresher to provide capacity to fetch fresh token
-
isRefreshProactively
public boolean isRefreshProactively()
- Returns:
- Whether or not to refresh token proactively
-
setRefreshProactively
public CommunicationTokenRefreshOptions setRefreshProactively(boolean refreshProactively)
Set whether the token should be proactively renewed prior to its expiry or on demand.- Parameters:
refreshProactively- the refreshProactively value to set.- Returns:
- the CommunicationTokenRefreshOptions object itself.
-
getInitialToken
public java.lang.String getInitialToken()
- Returns:
- The initial serialized JWT token
-
setInitialToken
public CommunicationTokenRefreshOptions setInitialToken(java.lang.String initialToken)
Set the optional serialized JWT token- Parameters:
initialToken- the initialToken value to set.- Returns:
- the CommunicationTokenRefreshOptions object itself.
-
-