Class CommunicationTokenRefreshOptions

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

public final class CommunicationTokenRefreshOptions extends Object
Options for refreshing CommunicationTokenCredential
  • Constructor Details

    • CommunicationTokenRefreshOptions

      @Deprecated public CommunicationTokenRefreshOptions(Supplier<Mono<String>> tokenRefresher, boolean refreshProactively)
      Deprecated.
      Creates a CommunicationTokenRefreshOptions object
      Parameters:
      tokenRefresher - The asynchronous callback function that acquires a fresh token from the Communication Identity API, e.g. by calling the CommunicationIdentityClient
      refreshProactively - Determines whether the token should be proactively renewed prior to its expiry or on demand.
    • CommunicationTokenRefreshOptions

      @Deprecated public CommunicationTokenRefreshOptions(Supplier<Mono<String>> tokenRefresher, boolean refreshProactively, String initialToken)
      Creates a CommunicationTokenRefreshOptions object
      Parameters:
      tokenRefresher - The asynchronous callback function that acquires a fresh token from the Communication Identity API, e.g. by calling the CommunicationIdentityClient
      refreshProactively - Determines whether the token should be proactively renewed prior to its expiry or on demand.
      initialToken - The optional serialized JWT token
    • CommunicationTokenRefreshOptions

      public CommunicationTokenRefreshOptions(Supplier<String> tokenRefresher)
      Creates a CommunicationTokenRefreshOptions object
      Parameters:
      tokenRefresher - The synchronous callback function that acquires a fresh token from the Communication Identity API, e.g. by calling the CommunicationIdentityClient The returned token must be valid (its expiration date must be set in the future).
  • Method Details

    • getTokenRefresher

      @Deprecated public Supplier<Mono<String>> getTokenRefresher()
      Deprecated.
      Use synchronous token refresher instead.
      Returns:
      The asynchronous token refresher to provide capacity to fetch fresh token
    • getTokenRefresherSync

      public Supplier<String> getTokenRefresherSync()
      Returns:
      The synchronous 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 String getInitialToken()
      Returns:
      The initial token
    • setInitialToken

      public CommunicationTokenRefreshOptions setInitialToken(String initialToken)
      Set the optional serialized JWT token
      Parameters:
      initialToken - the initialToken value to set.
      Returns:
      the CommunicationTokenRefreshOptions object itself.