TokenProvider

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.email.ITokenProvider

public class TokenProvider implements ITokenProvider

Class TokenProvider allows to retrieve access token for mail services.

Methods

Method Description
getInstance(String requestUrl, String clientId, String clientSecret, String refreshToken) Gets an instance of the OutlookTokenProvider for defined parameters.
dispose() Performs releasing resources.
getUseBasicAuthorization() Gets or sets value which indicates whether basic authorization is used
setUseBasicAuthorization(boolean value) Gets or sets value which indicates whether basic authorization is used
getLogin() Gets or sets login for basic authorization
setLogin(String value) Gets or sets login for basic authorization
getPassword() Gets or sets password for basic authorization
setPassword(String value) Gets or sets password for basic authorization
getRequestUrl() The url to obtain access token.
getExtraParameters() Gets extra parameters for request
getClientId() The client ID obtained during application registration.
getClientSecret() The client secret obtained during application registration.
getRefreshToken() OAuth 2.0 refresh token
getAccessToken() Gets oAuth access token.
getAccessToken(boolean ignoreExistingToken) Gets oAuth access token.

getInstance(String requestUrl, String clientId, String clientSecret, String refreshToken)

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

Gets an instance of the OutlookTokenProvider for defined parameters.

Parameters:

Parameter Type Description
requestUrl java.lang.String The url to obtain access token.
clientId java.lang.String The client ID obtained from the Microsoft account Developer Center during application registration.
clientSecret java.lang.String The client secret obtained during application registration.
refreshToken java.lang.String OAuth 2.0 refresh token

Returns: TokenProvider - Returns an instance of the OutlookTokenProvider for defined parameters.

dispose()

public void dispose()

Performs releasing resources.

getUseBasicAuthorization()

public boolean getUseBasicAuthorization()

Gets or sets value which indicates whether basic authorization is used

Returns: boolean

setUseBasicAuthorization(boolean value)

public void setUseBasicAuthorization(boolean value)

Gets or sets value which indicates whether basic authorization is used

Parameters:

Parameter Type Description
value boolean

getLogin()

public String getLogin()

Gets or sets login for basic authorization

Returns: java.lang.String

setLogin(String value)

public void setLogin(String value)

Gets or sets login for basic authorization

Parameters:

Parameter Type Description
value java.lang.String

getPassword()

public String getPassword()

Gets or sets password for basic authorization

Returns: java.lang.String

setPassword(String value)

public void setPassword(String value)

Gets or sets password for basic authorization

Parameters:

Parameter Type Description
value java.lang.String

getRequestUrl()

public String getRequestUrl()

The url to obtain access token.

Returns: java.lang.String

getExtraParameters()

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

Gets extra parameters for request

Returns: com.aspose.ms.System.Collections.Generic.KeyValuePair<java.lang.String,java.lang.String>[]

getClientId()

public String getClientId()

The client ID obtained during application registration.

Returns: java.lang.String

getClientSecret()

public String getClientSecret()

The client secret obtained during application registration.

Returns: java.lang.String

getRefreshToken()

public String getRefreshToken()

OAuth 2.0 refresh token

Returns: java.lang.String

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.

Returns: OAuthToken - Returns oAuth access token

getAccessToken(boolean ignoreExistingToken)

public OAuthToken getAccessToken(boolean ignoreExistingToken)

Gets oAuth access token.

Parameters:

Parameter Type Description
ignoreExistingToken boolean 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: OAuthToken - Returns oAuth access token