Class CommunicationTokenRefreshOptions


  • public final class CommunicationTokenRefreshOptions
    extends java.lang.Object
    Options for refreshing CommunicationTokenCredential

    This class is used to define how CommunicationTokenCredential should be refreshed

    • Constructor Detail

      • CommunicationTokenRefreshOptions

        @Deprecated
        public CommunicationTokenRefreshOptions​(java.util.concurrent.Callable<java.lang.String> tokenRefresher,
                                                boolean refreshProactively)
        Deprecated.
        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

        @Deprecated
        public CommunicationTokenRefreshOptions​(java.util.concurrent.Callable<java.lang.String> tokenRefresher,
                                                boolean refreshProactively,
                                                java.lang.String initialToken)
        Deprecated.
        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:
        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.