com.aspose.email

Interfaces

Classes

Enums

Exceptions

com.aspose.email

Class TokenProvider

  • All Implemented Interfaces:
    ITokenProvider, com.aspose.ms.System.IDisposable


    public class TokenProvider
    extends Object
    implements ITokenProvider

    Class TokenProvider allows to retrieve access token for mail services.

    • Method Detail

      • getInstance

        public static TokenProvider getInstance(String requestUrl,
                                String clientId,
                                String clientSecret,
                                String refreshToken)

        Gets an instance of the OutlookTokenProvider for defined parameters.

        Parameters:
        requestUrl - The url to obtain access token.
        clientId - The client ID obtained from the Microsoft account Developer Center during application registration.
        clientSecret - The client secret obtained during application registration.
        refreshToken - OAuth 2.0 refresh token
        Returns:
        Returns an instance of the OutlookTokenProvider for defined parameters.
      • dispose

        public void dispose()

        Performs releasing resources.

        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable
      • getUseBasicAuthorization

        public boolean getUseBasicAuthorization()

        Gets or sets value which indicates whether basic authorization is used

      • setUseBasicAuthorization

        public void setUseBasicAuthorization(boolean value)

        Gets or sets value which indicates whether basic authorization is used

      • getLogin

        public String getLogin()

        Gets or sets login for basic authorization

      • setLogin

        public void setLogin(String value)

        Gets or sets login for basic authorization

      • getPassword

        public String getPassword()

        Gets or sets password for basic authorization

      • setPassword

        public void setPassword(String value)

        Gets or sets password for basic authorization

      • getRequestUrl

        public String getRequestUrl()

        The url to obtain access token.

      • getExtraParameters

        public com.aspose.ms.System.Collections.Generic.KeyValuePair<String,String>[] getExtraParameters()

        Gets extra parameters for request

      • getClientId

        public String getClientId()

        The client ID obtained during application registration.

      • getClientSecret

        public String getClientSecret()

        The client secret obtained during application registration.

      • getRefreshToken

        public String getRefreshToken()

        OAuth 2.0 refresh token

      • getAccessToken

        public OAuthToken getAccessToken()

        Gets oAuth access token. If token exists and its expiration date is not expired returns current token, otherwise requests new token from a server.

        Specified by:
        getAccessToken in interface ITokenProvider
        Returns:
        Returns oAuth access token
      • getAccessToken

        public OAuthToken getAccessToken(boolean ignoreExistingToken)

        Gets oAuth access token.

        Specified by:
        getAccessToken in interface ITokenProvider
        Parameters:
        ignoreExistingToken - If ignoreExistingToken is true, requests new token from a server. Otherwise behaviour is depended on whether token exists or not. If token exists and its expiration date is not expired returns current token, otherwise requests new token from a server.
        Returns:
        Returns oAuth access token