public class OAuthSignature extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
OAuthSignature.HTTPMethod |
| Modifier and Type | Field and Description |
|---|---|
static String |
OAUTH_VERSION |
| Constructor and Description |
|---|
OAuthSignature(String consumerKey,
String consumerSecret)
Default Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(String name,
String value)
Adds Parameter.
|
String |
computeV1Signature()
Computes OAuth Signature as per OAuth specification using signature
Method.
|
static Map |
getAuthHeader(String apiUserName,
String apiPassword,
String accessToken,
String tokenSecret,
OAuthSignature.HTTPMethod httpMethod,
String scriptURI,
Map queryParams)
Accepts the required parameters and Provides OAuth signature and
TimeStamp.
|
static String |
getFullAuthString(String apiUserName,
String apiPassword,
String accessToken,
String tokenSecret,
OAuthSignature.HTTPMethod httpMethod,
String scriptURI,
Map queryParams)
Computes the value of the X_PP_AUTHORIZATION header
|
void |
setHTTPMethod(OAuthSignature.HTTPMethod method)
Sets HTTP Method
|
void |
setRequestURI(String uri)
Sets URI for signature computation.
|
void |
setToken(String token)
Sets Token to be used to generate signature.
|
void |
setTokenSecret(String secret)
Sets Token secret as received in Token response.
|
void |
setTokenTimestamp(String timestamp)
Sets time stamp for signature computation.
|
boolean |
verifyV1Signature(String signature)
verifyV1Signature verifies signature against computed signature.
|
public static final String OAUTH_VERSION
public void setToken(String token)
token - - String version of Token. The token could be Access or
Requestpublic void addParameter(String name, String value)
name - parameter name with no URL encoding appliedvalue - parameter value with no URL encoding appliedpublic void setTokenSecret(String secret)
secret - byte array of token secretpublic void setRequestURI(String uri) throws OAuthException
uri - - Script URI which will be normalized to
scheme://authority:port/path if not normalized already.OAuthExceptionpublic void setTokenTimestamp(String timestamp)
timestamp - - time stamp at which Token request sends.public void setHTTPMethod(OAuthSignature.HTTPMethod method)
method - HTTP method used for sending OAuth requestpublic String computeV1Signature() throws OAuthException
enc.
OAuthException - if invalid arguments.public boolean verifyV1Signature(String signature) throws OAuthException
OAuthException - in case there are any failures in signature computation.public static Map getAuthHeader(String apiUserName, String apiPassword, String accessToken, String tokenSecret, OAuthSignature.HTTPMethod httpMethod, String scriptURI, Map queryParams) throws OAuthException
apiUserName - API User name.apiPassword - API Password of user.accessToken - Obtained during Permission Request of token.tokenSecret - Obtained during Permission Request of token.httpMethod - HTTP Method (GET,POST etc.)scriptURI - API Server End Point.queryParams - Extra 'name/value' parameters if required.Map of HTTPHeadersOAuthExceptionpublic static String getFullAuthString(String apiUserName, String apiPassword, String accessToken, String tokenSecret, OAuthSignature.HTTPMethod httpMethod, String scriptURI, Map queryParams) throws OAuthException
apiUserName - API User name.apiPassword - API Password of user.accessToken - Obtained during Permission Request of token.tokenSecret - Obtained during Permission Request of token.httpMethod - HTTP Method (GET,POST etc.)scriptURI - API Server End Point.queryParams - Extra 'name/value' parameters if required.OAuthExceptionCopyright © 2016. All Rights Reserved.