public class OAuthParameters
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
OAuthParameters.OAuthType
Type of OAuth for this parameter set (i.e., two-legged or three-legged
OAuth (see "https://sites.google.com/a/google.com/oauth/").
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
OAUTH_CALLBACK_KEY |
static java.lang.String |
OAUTH_CONSUMER_KEY |
static java.lang.String |
OAUTH_CONSUMER_SECRET |
static java.lang.String |
OAUTH_KEY |
static java.lang.String |
OAUTH_NONCE_KEY |
static java.lang.String |
OAUTH_SIGNATURE_KEY |
static java.lang.String |
OAUTH_SIGNATURE_METHOD_KEY |
static java.lang.String |
OAUTH_TIMESTAMP_KEY |
static java.lang.String |
OAUTH_TOKEN_KEY |
static java.lang.String |
OAUTH_TOKEN_SECRET_KEY |
static java.lang.String |
OAUTH_VERIFIER_KEY |
static java.lang.String |
REALM_KEY |
static java.lang.String |
XOAUTH_REQUESTOR_ID_KEY |
Constructor and Description |
---|
OAuthParameters()
Creates a new
OAuthParameters object. |
Modifier and Type | Method and Description | ||
---|---|---|---|
void |
addCustomBaseParameter(java.lang.String key,
java.lang.String value)
Adds a parameter to be used when generating the OAuth signature.
|
||
void |
addExtraParameter(java.lang.String key,
java.lang.String value)
Sets a parameter related to OAuth (but not used when generating the
signature).
|
||
void |
assertOAuthCallbackExists()
Checks to see if the OAuth callback exists.
|
||
void |
assertOAuthConsumerKeyExists()
Checks to see if the OAuth Consumer Key exists.
|
||
void |
assertOAuthConsumerSecretExists() |
||
void |
assertOAuthNonceExists()
Checks to see if the OAuth nonce exists.
|
||
void |
assertOAuthSignatureExists()
Checks to see if the OAuth signature exists.
|
||
void |
assertOAuthSignatureMethodExists()
Checks to see if the OAuth signature method exists.
|
||
void |
assertOAuthTimestampExists()
Checks to see if the OAuth timestamp exists.
|
||
void |
assertOAuthTokenExists()
Checks to see if the OAuth token exists.
|
||
void |
assertOAuthTokenSecretExists()
Checks to see if the OAuth token secret exists.
|
||
void |
assertOAuthVerifierExists()
Checks to see if the OAuth Verifier exists.
|
||
void |
assertRealmExists()
Checks to see if the realm exists.
|
||
boolean |
checkOAuthCallbackExists()
Checks to see if the OAuth callback exists.
|
||
boolean |
checkOAuthConsumerKeyExists()
Checks to see if the OAuth Consumer Key exists.
|
||
boolean |
checkOAuthConsumerSecretExists() |
||
boolean |
checkOAuthNonceExists()
Checks to see if the OAuth nonce exists.
|
||
boolean |
checkOAuthSignatureExists()
Checks to see if the OAuth signature exists.
|
||
boolean |
checkOAuthSignatureMethodExists()
Checks to see if the OAuth signature method exists.
|
||
boolean |
checkOAuthTimestampExists()
Checks to see if the OAuth timestamp exists.
|
||
boolean |
checkOAuthTokenExists()
Checks to see if the OAuth token exists.
|
||
boolean |
checkOAuthTokenSecretExists()
Checks to see if the OAuth token secret exists.
|
||
boolean |
checkOAuthVerifierExists()
Checks to see if the OAuth Verifier exists.
|
||
boolean |
checkRealmExists()
Checks to see if the realm exists.
|
||
java.util.Map<java.lang.String,java.lang.String> |
getBaseParameters()
Return the parameters used to calculate the OAuth signature.
|
||
java.util.Map<java.lang.String,java.lang.String> |
getExtraParameters()
Returns any other parameters used in the OAuth process, such as the
OAuth callback url.
|
||
java.lang.String |
getOAuthCallback()
Returns the OAuth callback url.
|
||
java.lang.String |
getOAuthConsumerKey()
Returns the OAuth Consumer Key.
|
||
java.lang.String |
getOAuthConsumerSecret() |
||
java.lang.String |
getOAuthNonce()
Returns the OAuth nonce.
|
||
java.lang.String |
getOAuthSignature()
Returns the OAuth signature used to sign the current request.
|
||
java.lang.String |
getOAuthSignatureMethod()
Returns the OAuth Signature Method.
|
||
java.lang.String |
getOAuthTimestamp()
Returns the OAuth timestamp.
|
||
java.lang.String |
getOAuthToken()
Returns the OAuth token.
|
||
java.lang.String |
getOAuthTokenSecret()
Returns the OAuth Token Secret.
|
||
OAuthParameters.OAuthType |
getOAuthType()
Retrieves the OAuth type requested.
|
||
java.lang.String |
getOAuthVerifier()
Returns the OAuth Verifier.
|
||
java.lang.String |
getRealm()
Returns the Realm parameter to be used in the authorization header, as
defined by
void removeCustomBaseParameter(java.lang.String key)
Removes a parameter from the OAuth signature.
| ||
void |
reset()
Resets all transient parameters related to a single request, so that these
parameters do not interfere with multiple requests.
|
||
void |
setOAuthCallback(java.lang.String oauthCallback)
Sets the OAuth callback url.
|
||
void |
setOAuthConsumerKey(java.lang.String consumerKey)
Sets the OAuth Consumer Key.
|
||
void |
setOAuthConsumerSecret(java.lang.String consumerSecret) |
||
void |
setOAuthNonce(java.lang.String oauthNonce)
Sets the OAuth nonce.
|
||
void |
setOAuthSignature(java.lang.String signature)
Sets the OAuth signature used to sign the current request.
|
||
void |
setOAuthSignatureMethod(java.lang.String signatureMethod)
Sets the OAuth Signature Method.
|
||
void |
setOAuthTimestamp(java.lang.String timestamp)
Sets the OAuth timestamp.
|
||
void |
setOAuthToken(java.lang.String token)
Sets the OAuth token.
|
||
void |
setOAuthTokenSecret(java.lang.String tokenSecret)
Returns the OAuth Token Secret.
|
||
void |
setOAuthType(OAuthParameters.OAuthType type)
Sets the value of the OAuth type.
|
||
void |
setOAuthVerifier(java.lang.String verifier)
Returns the OAuth Verifier.
|
||
void |
setRealm(java.lang.String realm)
Sets the Realm parameter.
|
public static final java.lang.String OAUTH_CALLBACK_KEY
public static final java.lang.String OAUTH_CONSUMER_KEY
public static final java.lang.String OAUTH_CONSUMER_SECRET
public static final java.lang.String OAUTH_NONCE_KEY
public static final java.lang.String OAUTH_KEY
public static final java.lang.String OAUTH_SIGNATURE_KEY
public static final java.lang.String OAUTH_SIGNATURE_METHOD_KEY
public static final java.lang.String OAUTH_TIMESTAMP_KEY
public static final java.lang.String OAUTH_TOKEN_KEY
public static final java.lang.String OAUTH_TOKEN_SECRET_KEY
public static final java.lang.String OAUTH_VERIFIER_KEY
public static final java.lang.String REALM_KEY
public static final java.lang.String XOAUTH_REQUESTOR_ID_KEY
public OAuthParameters()
OAuthParameters
object. Initializes parameters
containers.public java.util.Map<java.lang.String,java.lang.String> getBaseParameters()
public java.util.Map<java.lang.String,java.lang.String> getExtraParameters()
public void addCustomBaseParameter(java.lang.String key, java.lang.String value)
key
- The key used to reference this parameter. This key will also be
used to reference the value in the request url and in the http
authorization header.value
- the value of the parameterpublic void removeCustomBaseParameter(java.lang.String key)
key
- The key used to reference this parameter.public void addExtraParameter(java.lang.String key, java.lang.String value)
key
- the key used to reference this parametervalue
- the value of the parameterpublic void reset()
public java.lang.String getOAuthConsumerKey()
public void setOAuthConsumerKey(java.lang.String consumerKey)
getOAuthConsumerKey()
to learn
more about this parameter.public boolean checkOAuthConsumerKeyExists()
getOAuthConsumerKey()
to learn more about this parameter.public void assertOAuthConsumerKeyExists() throws OAuthException
getOAuthConsumerKey()
to learn more about this
parameter.OAuthException
- if the OAuth Consumer Key does not existpublic java.lang.String getOAuthConsumerSecret()
public void setOAuthConsumerSecret(java.lang.String consumerSecret)
public boolean checkOAuthConsumerSecretExists()
public void assertOAuthConsumerSecretExists() throws OAuthException
OAuthException
public java.lang.String getOAuthNonce()
OAuthUtil.getNonce()
if it is not provided. This parameter is
included in the OAuth signature base string.public void setOAuthNonce(java.lang.String oauthNonce)
getOAuthNonce()
to learn more about
this parameter.public boolean checkOAuthNonceExists()
getOAuthNonce()
to
learn more about this parameter.public void assertOAuthNonceExists() throws OAuthException
getOAuthNonce()
to learn more about this
parameter.OAuthException
- if the OAuth nonce does not existpublic java.lang.String getOAuthSignature()
OAuthHelper
if it is
not provided.public void setOAuthSignature(java.lang.String signature)
getOAuthSignature()
to learn more about this parameter.public boolean checkOAuthSignatureExists()
getOAuthSignature()
to learn more about this parameter.public void assertOAuthSignatureExists() throws OAuthException
getOAuthSignature()
to learn more about this
parameter.OAuthException
- if the OAuth signature does not existpublic java.lang.String getOAuthSignatureMethod()
OAuthSigner
if it is not provided by the user. This
parameter is included in the OAuth signature base string.public void setOAuthSignatureMethod(java.lang.String signatureMethod)
getOAuthSignatureMethod()
to
learn more about this parameter.public boolean checkOAuthSignatureMethodExists()
getOAuthSignatureMethod()
to learn more about this parameter.public void assertOAuthSignatureMethodExists() throws OAuthException
getOAuthSignatureMethod()
to learn more about
this parameter.OAuthException
- if the OAuth signature method does not existpublic java.lang.String getOAuthTimestamp()
OAuthUtil.getTimestamp()
if it is not provided by
the user. This parameter is included in the OAuth signature base string.public void setOAuthTimestamp(java.lang.String timestamp)
getOAuthTimestamp()
to learn more
about this parameter.public boolean checkOAuthTimestampExists()
getOAuthTimestamp()
to learn more about this parameter.public void assertOAuthTimestampExists() throws OAuthException
getOAuthTimestamp()
to learn more about this
parameter.OAuthException
- if the OAuth timestamp does not existpublic java.lang.String getOAuthToken()
OAuthHelper
. This parameter is included in the OAuth signature
base string.public void setOAuthToken(java.lang.String token)
getOAuthToken()
to learn more about
this parameter.public boolean checkOAuthTokenExists()
getOAuthToken()
to
learn more about this parameter.public void assertOAuthTokenExists() throws OAuthException
getOAuthToken()
to learn more about this
parameter.OAuthException
- if the OAuth token does not existpublic java.lang.String getOAuthTokenSecret()
public void setOAuthTokenSecret(java.lang.String tokenSecret)
getOAuthTokenSecret()
to
learn more about this parameter.public boolean checkOAuthTokenSecretExists()
getOAuthTokenSecret()
to learn more about this parameter.public void assertOAuthTokenSecretExists() throws OAuthException
getOAuthTokenSecret()
to learn more about this
parameter.OAuthException
- if the OAuth token secret does not existpublic OAuthParameters.OAuthType getOAuthType()
public void setOAuthType(OAuthParameters.OAuthType type)
public java.lang.String getOAuthVerifier()
public void setOAuthVerifier(java.lang.String verifier)
getOAuthVerifier()
to
learn more about this parameter.public boolean checkOAuthVerifierExists()
getOAuthTokenSecret()
to learn more about this parameter.public void assertOAuthVerifierExists() throws OAuthException
getOAuthVerifier()
to learn more about this
parameter.OAuthException
- if the OAuth token secret does not existpublic java.lang.String getOAuthCallback()
public void setOAuthCallback(java.lang.String oauthCallback)
getOAuthCallback()
to learn more
about this parameter.public boolean checkOAuthCallbackExists()
getOAuthCallback()
to learn more about this parameter.public void assertOAuthCallbackExists() throws OAuthException
getOAuthCallback()
to learn more about this
parameter.OAuthException
- if the OAuth callback does not existpublic java.lang.String getRealm()
public void setRealm(java.lang.String realm)
getRealm()
to learn more about this
parameter.public boolean checkRealmExists()
getRealm()
to learn more
about this parameter.public void assertRealmExists() throws OAuthException
getRealm()
to learn more about this parameter.OAuthException
- if the realm does not exist