Share via


CommunicationTokenRefreshOptions Class

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

public final class CommunicationTokenRefreshOptions

Options for refreshing CommunicationTokenCredential

Constructor Summary

Constructor Description
CommunicationTokenRefreshOptions(Supplier<String> tokenRefresher)

Creates a CommunicationTokenRefreshOptions object

CommunicationTokenRefreshOptions(Supplier<Mono<String>> tokenRefresher, boolean refreshProactively)

Deprecated

Creates a CommunicationTokenRefreshOptions object

CommunicationTokenRefreshOptions(Supplier<Mono<String>> tokenRefresher, boolean refreshProactively, String initialToken)

Deprecated

Creates a CommunicationTokenRefreshOptions object

Method Summary

Modifier and Type Method and Description
String getInitialToken()

Gets the initial token

Supplier<Mono<String>> getTokenRefresher()

Deprecated

Use synchronous token refresher instead.

Gets the asynchronous token refresher to provide capacity to fetch fresh token

Supplier<String> getTokenRefresherSync()

Gets the synchronous token refresher to provide capacity to fetch fresh token

boolean isRefreshProactively()

Whether to refresh token proactively

CommunicationTokenRefreshOptions setInitialToken(String initialToken)

Set the optional serialized JWT token

CommunicationTokenRefreshOptions setRefreshProactively(boolean refreshProactively)

Set whether the token should be proactively renewed prior to its expiry or on demand.

Methods inherited from java.lang.Object

Constructor Details

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).

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)

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.
initialToken - The optional serialized JWT token

Method Details

getInitialToken

public String getInitialToken()

Gets the initial token

Returns:

The initial token

getTokenRefresher

@Deprecated
public Supplier<Mono<String>> getTokenRefresher()

Deprecated

Use synchronous token refresher instead.

Gets the asynchronous token refresher to provide capacity to fetch fresh token

Returns:

The asynchronous token refresher to provide capacity to fetch fresh token

getTokenRefresherSync

public Supplier<String> getTokenRefresherSync()

Gets the synchronous token refresher to provide capacity to fetch fresh token

Returns:

The synchronous token refresher to provide capacity to fetch fresh token

isRefreshProactively

public boolean isRefreshProactively()

Whether to refresh token proactively

Returns:

Whether to refresh token proactively

setInitialToken

public CommunicationTokenRefreshOptions setInitialToken(String initialToken)

Set the optional serialized JWT token

Parameters:

initialToken - the initialToken value to set.

Returns:

the CommunicationTokenRefreshOptions object itself.

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.

Applies to