Class CommunicationTokenRefreshOptions

java.lang.Object
com.azure.android.communication.common.CommunicationTokenRefreshOptions

public final class CommunicationTokenRefreshOptions extends Object
Options for refreshing CommunicationTokenCredential

This class is used to define how CommunicationTokenCredential should be refreshed

  • Constructor Details

    • CommunicationTokenRefreshOptions

      public CommunicationTokenRefreshOptions(Callable<String> tokenRefresher, boolean refreshProactively)
      Creates a CommunicationTokenRefreshOptions object

      Access 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 null
      refreshProactively - 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 a CommunicationTokenRefreshOptions object

      A valid token is supplied and may optionally enable proactive refreshing

      Parameters:
      tokenRefresher - the token refresher to provide capacity to fetch fresh token, cannot be null
      refreshProactively - 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
      initialToken - the serialized JWT token, cannot be null
      Throws:
      IllegalArgumentException - if the parameter tokenRefresher or initialToken is null.
  • Method Details

    • getTokenRefresher

      public Callable<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
    • getInitialToken

      public String getInitialToken()
      Returns:
      the serialized JWT token