Package com.smartsheet.api.oauth
Interface OAuthFlow
-
public interface OAuthFlow
OAuthFlow interface provides methods to do the OAuth2 authorization.
Thread Safety: Implementation of this interface must be thread safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AuthorizationResult
extractAuthorizationResult(java.lang.String authorizationResponseURL)
Extract AuthorizationResult from the authorization response URL (i.e.java.lang.String
newAuthorizationURL(java.util.EnumSet<AccessScope> scopes, java.lang.String state)
Generate a new authorization URL.Token
obtainNewToken(AuthorizationResult authorizationResult)
Obtain a new token using AuthorizationResult.Token
refreshToken(Token token)
Refresh token.void
revokeAccessToken(Token token)
Revoke access token.
-
-
-
Method Detail
-
newAuthorizationURL
java.lang.String newAuthorizationURL(java.util.EnumSet<AccessScope> scopes, java.lang.String state)
Generate a new authorization URL.
- Parameters:
scopes
- the requested scopesstate
- an arbitrary string that will be returned to your app; intended to be used by you to ensure that this redirect is indeed from an OAuth flow that you initiated.- Returns:
- the authorization URL
- Throws:
java.lang.IllegalArgumentException
- if scopes is null or empty
-
extractAuthorizationResult
AuthorizationResult extractAuthorizationResult(java.lang.String authorizationResponseURL) throws java.net.URISyntaxException, AccessDeniedException, UnsupportedResponseTypeException, InvalidScopeException, OAuthAuthorizationCodeException
Extract AuthorizationResult from the authorization response URL (i.e. the redirectURL with the response parameters from Smartsheet OAuth server).- Parameters:
authorizationResponseURL
- the authorization response url- Returns:
- the authorization result
- Throws:
java.net.URISyntaxException
- the URI syntax exceptionAccessDeniedException
- the access denied exceptionUnsupportedResponseTypeException
- the unsupported response type exceptionInvalidScopeException
- the invalid scope exceptionOAuthAuthorizationCodeException
- the o auth authorization code exceptionjava.lang.IllegalArgumentException
- if any other error occurred during the operation
-
obtainNewToken
Token obtainNewToken(AuthorizationResult authorizationResult) throws OAuthTokenException, com.smartsheet.api.internal.json.JSONSerializerException, com.smartsheet.api.internal.http.HttpClientException, java.net.URISyntaxException, InvalidRequestException
Obtain a new token using AuthorizationResult.- Parameters:
authorizationResult
- the authorization result- Returns:
- the token
- Throws:
OAuthTokenException
- the o auth token exceptioncom.smartsheet.api.internal.json.JSONSerializerException
- the JSON serializer exceptioncom.smartsheet.api.internal.http.HttpClientException
- the http client exceptionjava.net.URISyntaxException
- the URI syntax exceptionInvalidRequestException
- the invalid request exceptionjava.lang.IllegalArgumentException
- if any other error occurred during the operation
-
refreshToken
Token refreshToken(Token token) throws OAuthTokenException, com.smartsheet.api.internal.json.JSONSerializerException, com.smartsheet.api.internal.http.HttpClientException, java.net.URISyntaxException, InvalidRequestException
Refresh token.- Parameters:
token
- the token to refresh- Returns:
- the refreshed token
- Throws:
OAuthTokenException
- the o auth token exceptioncom.smartsheet.api.internal.json.JSONSerializerException
- the JSON serializer exceptioncom.smartsheet.api.internal.http.HttpClientException
- the http client exceptionjava.net.URISyntaxException
- the URI syntax exceptionInvalidRequestException
- the invalid request exceptionjava.lang.IllegalArgumentException
- if any other error occurred during the operation
-
revokeAccessToken
void revokeAccessToken(Token token) throws OAuthTokenException, com.smartsheet.api.internal.json.JSONSerializerException, com.smartsheet.api.internal.http.HttpClientException, java.net.URISyntaxException, InvalidRequestException
Revoke access token.Exceptions: - IllegalArgumentException : if url is null or empty - InvalidTokenRequestException : if the token request is invalid - InvalidOAuthClientException : if the client information is invalid - InvalidOAuthGrantException : if the authorization code or refresh token is invalid or expired, the redirect_uri does not match, or the hash value does not match the client secret and/or code - UnsupportedOAuthGrantTypeException : if the grant type is invalid - OAuthTokenException : if any other error occurred during the operation
- Parameters:
token
- the access token to revoke access from- Throws:
OAuthTokenException
- the o auth token exceptioncom.smartsheet.api.internal.json.JSONSerializerException
- the JSON serializer exceptioncom.smartsheet.api.internal.http.HttpClientException
- the http client exceptionjava.net.URISyntaxException
- the URI syntax exceptionInvalidRequestException
- the invalid request exception
-
-