# Google Data APIs Client Library (1.43.0)

## com.google.gdata.client.authn.oauth
Class OAuthParameters

    java.lang.Object
      com.google.gdata.client.authn.oauth.OAuthParameters

Direct Known Subclasses:
  GoogleOAuthParameters

    public class OAuthParameters

extends java.lang.Object

Container for OAuth-related parameters. The parameters are divided into two categories: those used to generate the signature base string, and other parameters. For each parameter, there are 4 different types of methods: a getter, a setter, a check if the parameter exists (that returns a boolean) and a check if the parameter exists (that throws an exception). Refer to the getters/setters for each parameter below to learn more about the parameter.

Nested Class Summary
`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/").

Field Summary
`protected java.util.Map<java.lang.String,java.lang.String>` `baseParameters`
`protected java.util.Map<java.lang.String,java.lang.String>` `extraParameters`
`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 Summary
`OAuthParameters()` Creates a new `OAuthParameters` object.

Method Summary
`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).
`protected void` `assertExists(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> params)` Checks the given key to see if it exists, and throws an exception if it does not.
`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.
`protected boolean` `checkExists(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> params)` Checks the given key to see if it 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.
`protected java.lang.String` `get(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> params)` Retrieves the value with the given key from the input map.
`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 `protected void` `put(java.lang.String key, java.lang.String value, java.util.Map<java.lang.String,java.lang.String> params)` Adds the key/value pair to the input map.
`protected void` `remove(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> params)` Removes a key/value pair from the input map.
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### OAUTH_CALLBACK_KEY

    public static final java.lang.String OAUTH_CALLBACK_KEY

See Also:
  Constant Field Values

### OAUTH_CONSUMER_KEY

    public static final java.lang.String OAUTH_CONSUMER_KEY

See Also:
  Constant Field Values

### OAUTH_CONSUMER_SECRET

    public static final java.lang.String OAUTH_CONSUMER_SECRET

See Also:
  Constant Field Values

### OAUTH_NONCE_KEY

    public static final java.lang.String OAUTH_NONCE_KEY

See Also:
  Constant Field Values

### OAUTH_KEY

    public static final java.lang.String OAUTH_KEY

See Also:
  Constant Field Values

### OAUTH_SIGNATURE_KEY

    public static final java.lang.String OAUTH_SIGNATURE_KEY

See Also:
  Constant Field Values

### OAUTH_SIGNATURE_METHOD_KEY

    public static final java.lang.String OAUTH_SIGNATURE_METHOD_KEY

See Also:
  Constant Field Values

### OAUTH_TIMESTAMP_KEY

    public static final java.lang.String OAUTH_TIMESTAMP_KEY

See Also:
  Constant Field Values

### OAUTH_TOKEN_KEY

    public static final java.lang.String OAUTH_TOKEN_KEY

See Also:
  Constant Field Values

### OAUTH_TOKEN_SECRET_KEY

    public static final java.lang.String OAUTH_TOKEN_SECRET_KEY

See Also:
  Constant Field Values

### OAUTH_VERIFIER_KEY

    public static final java.lang.String OAUTH_VERIFIER_KEY

See Also:
  Constant Field Values

### REALM_KEY

    public static final java.lang.String REALM_KEY

See Also:
  Constant Field Values

### XOAUTH_REQUESTOR_ID_KEY

    public static final java.lang.String XOAUTH_REQUESTOR_ID_KEY

See Also:
  Constant Field Values

### baseParameters

    protected java.util.Map<java.lang.String,java.lang.String> baseParameters

### extraParameters

    protected java.util.Map<java.lang.String,java.lang.String> extraParameters

Constructor Detail

### OAuthParameters

    public OAuthParameters()

  Creates a new `OAuthParameters` object. Initializes parameters containers.

Method Detail

### getBaseParameters

    public java.util.Map<java.lang.String,java.lang.String> getBaseParameters()

  Return the parameters used to calculate the OAuth signature.

  Returns:
    a map of key/value pairs to use in the signature base string

### getExtraParameters

    public 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.

  Returns:
    a map of key/value pairs for the extra parameters

### addCustomBaseParameter

    public void addCustomBaseParameter(java.lang.String key,
                                       java.lang.String value)

  Adds a parameter to be used when generating the OAuth signature.

  Parameters:
    `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 parameter

### removeCustomBaseParameter

    public void removeCustomBaseParameter(java.lang.String key)

  Removes a parameter from the OAuth signature.

  Parameters:
    `key` - The key used to reference this parameter.

### addExtraParameter

    public void addExtraParameter(java.lang.String key,
                                  java.lang.String value)

  Sets a parameter related to OAuth (but not used when generating the signature).

  Parameters:
    `key` - the key used to reference this parameter
    `value` - the value of the parameter

### reset

    public void reset()

  Resets all transient parameters related to a single request, so that these parameters do not interfere with multiple requests.

### getOAuthConsumerKey

    public java.lang.String getOAuthConsumerKey()

  Returns the OAuth Consumer Key. The OAuth Consumer Key is a value used by the Consumer to identify itself to the Service Provider. This parameter is required for all OAuth requests. This parameter is included in the OAuth signature base string.

### setOAuthConsumerKey

    public void setOAuthConsumerKey(java.lang.String consumerKey)

  Sets the OAuth Consumer Key. See `getOAuthConsumerKey()` to learn more about this parameter.

### checkOAuthConsumerKeyExists

    public boolean checkOAuthConsumerKeyExists()

  Checks to see if the OAuth Consumer Key exists. See `getOAuthConsumerKey()` to learn more about this parameter.

  Returns:
    true if the OAuth Consumer Key exists, false otherwise

### assertOAuthConsumerKeyExists

    public void assertOAuthConsumerKeyExists()
                                      throws OAuthException

  Checks to see if the OAuth Consumer Key exists. Throws an exception if it does not. See `getOAuthConsumerKey()` to learn more about this parameter.

  Throws:
    `OAuthException` - if the OAuth Consumer Key does not exist

### getOAuthConsumerSecret

    public java.lang.String getOAuthConsumerSecret()

### setOAuthConsumerSecret

    public void setOAuthConsumerSecret(java.lang.String consumerSecret)

### checkOAuthConsumerSecretExists

    public boolean checkOAuthConsumerSecretExists()

### assertOAuthConsumerSecretExists

    public void assertOAuthConsumerSecretExists()
                                         throws OAuthException

  Throws:
    `OAuthException`

### getOAuthNonce

    public java.lang.String getOAuthNonce()

  Returns the OAuth nonce. OAuth defines the nonce as "a random string, uniquely generated for each request. The nonce allows the Service Provider to verify that a request has never been made before and helps prevent replay attacks when requests are made over a non-secure channel (such as HTTP)." This parameter is optional, and it will be supplied by `OAuthUtil.getNonce()` if it is not provided. This parameter is included in the OAuth signature base string.

### setOAuthNonce

    public void setOAuthNonce(java.lang.String oauthNonce)

  Sets the OAuth nonce. See `getOAuthNonce()` to learn more about this parameter.

### checkOAuthNonceExists

    public boolean checkOAuthNonceExists()

  Checks to see if the OAuth nonce exists. See `getOAuthNonce()` to learn more about this parameter.

  Returns:
    true if the OAuth nonce exists, false otherwise

### assertOAuthNonceExists

    public void assertOAuthNonceExists()
                                throws OAuthException

  Checks to see if the OAuth nonce exists. Throws an exception if it does not. See `getOAuthNonce()` to learn more about this parameter.

  Throws:
    `OAuthException` - if the OAuth nonce does not exist

### getOAuthSignature

    public java.lang.String getOAuthSignature()

  Returns the OAuth signature used to sign the current request. This parameter is optional, and it will be set by `OAuthHelper` if it is not provided.

### setOAuthSignature

    public void setOAuthSignature(java.lang.String signature)

  Sets the OAuth signature used to sign the current request. See `getOAuthSignature()` to learn more about this parameter.

### checkOAuthSignatureExists

    public boolean checkOAuthSignatureExists()

  Checks to see if the OAuth signature exists. See `getOAuthSignature()` to learn more about this parameter.

  Returns:
    true if the OAuth signature exists, false otherwise

### assertOAuthSignatureExists

    public void assertOAuthSignatureExists()
                                    throws OAuthException

  Checks to see if the OAuth signature exists. Throws an exception if it does not. See `getOAuthSignature()` to learn more about this parameter.

  Throws:
    `OAuthException` - if the OAuth signature does not exist

### getOAuthSignatureMethod

    public java.lang.String getOAuthSignatureMethod()

  Returns the OAuth Signature Method. Valid values are "RSA-SHA1", "HMAC-SHA1" and "PLAINTEXT". This parameter is optional, and will be supplied by `OAuthSigner` if it is not provided by the user. This parameter is included in the OAuth signature base string.

### setOAuthSignatureMethod

    public void setOAuthSignatureMethod(java.lang.String signatureMethod)

  Sets the OAuth Signature Method. See `getOAuthSignatureMethod()` to learn more about this parameter.

### checkOAuthSignatureMethodExists

    public boolean checkOAuthSignatureMethodExists()

  Checks to see if the OAuth signature method exists. See `getOAuthSignatureMethod()` to learn more about this parameter.

  Returns:
    true if the OAuth signature method exists, false otherwise

### assertOAuthSignatureMethodExists

    public void assertOAuthSignatureMethodExists()
                                          throws OAuthException

  Checks to see if the OAuth signature method exists. Throws an exception if it does not. See `getOAuthSignatureMethod()` to learn more about this parameter.

  Throws:
    `OAuthException` - if the OAuth signature method does not exist

### getOAuthTimestamp

    public java.lang.String getOAuthTimestamp()

  Returns the OAuth timestamp. OAuth defines the timestamp as "the number of seconds since January 1, 1970 00:00:00 GMT. The timestamp value MUST be a positive integer and MUST be equal or greater than the timestamp used in previous requests." This parameter is optional, and will be supplied by `OAuthUtil.getTimestamp()` if it is not provided by the user. This parameter is included in the OAuth signature base string.

### setOAuthTimestamp

    public void setOAuthTimestamp(java.lang.String timestamp)

  Sets the OAuth timestamp. See `getOAuthTimestamp()` to learn more about this parameter.

### checkOAuthTimestampExists

    public boolean checkOAuthTimestampExists()

  Checks to see if the OAuth timestamp exists. See `getOAuthTimestamp()` to learn more about this parameter.

  Returns:
    true if the OAuth timestamp exists, false otherwise

### assertOAuthTimestampExists

    public void assertOAuthTimestampExists()
                                    throws OAuthException

  Checks to see if the OAuth timestamp exists. Throws an exception if it does not. See `getOAuthTimestamp()` to learn more about this parameter.

  Throws:
    `OAuthException` - if the OAuth timestamp does not exist

### getOAuthToken

    public java.lang.String getOAuthToken()

  Returns the OAuth token. This token may either be the unauthorized request token, the user-authorized request token, or the access token. This parameter is optional, and will be modified by the methods in `OAuthHelper`. This parameter is included in the OAuth signature base string.

### setOAuthToken

    public void setOAuthToken(java.lang.String token)

  Sets the OAuth token. See `getOAuthToken()` to learn more about this parameter.

### checkOAuthTokenExists

    public boolean checkOAuthTokenExists()

  Checks to see if the OAuth token exists. See `getOAuthToken()` to learn more about this parameter.

  Returns:
    true if the OAuth token exists, false otherwise

### assertOAuthTokenExists

    public void assertOAuthTokenExists()
                                throws OAuthException

  Checks to see if the OAuth token exists. Throws an exception if it does not. See `getOAuthToken()` to learn more about this parameter.

  Throws:
    `OAuthException` - if the OAuth token does not exist

### getOAuthTokenSecret

    public java.lang.String getOAuthTokenSecret()

  Returns the OAuth Token Secret. The OAuth Token Secret is a secret used by the Consumer to establish ownership of a given Token. This parameter is optional.

### setOAuthTokenSecret

    public void setOAuthTokenSecret(java.lang.String tokenSecret)

  Returns the OAuth Token Secret. See `getOAuthTokenSecret()` to learn more about this parameter.

### checkOAuthTokenSecretExists

    public boolean checkOAuthTokenSecretExists()

  Checks to see if the OAuth token secret exists. See `getOAuthTokenSecret()` to learn more about this parameter.

  Returns:
    true if the OAuth token secret exists, false otherwise

### assertOAuthTokenSecretExists

    public void assertOAuthTokenSecretExists()
                                      throws OAuthException

  Checks to see if the OAuth token secret exists. Throws an exception if it does not. See `getOAuthTokenSecret()` to learn more about this parameter.

  Throws:
    `OAuthException` - if the OAuth token secret does not exist

### getOAuthType

    public OAuthParameters.OAuthType getOAuthType()

  Retrieves the OAuth type requested.

### setOAuthType

    public void setOAuthType(OAuthParameters.OAuthType type)

  Sets the value of the OAuth type.

### getOAuthVerifier

    public java.lang.String getOAuthVerifier()

  Returns the OAuth Verifier.

### setOAuthVerifier

    public void setOAuthVerifier(java.lang.String verifier)

  Returns the OAuth Verifier. See `getOAuthVerifier()` to learn more about this parameter.

### checkOAuthVerifierExists

    public boolean checkOAuthVerifierExists()

  Checks to see if the OAuth Verifier exists. See `getOAuthTokenSecret()` to learn more about this parameter.

  Returns:
    true if the OAuth Verifier exists, false otherwise

### assertOAuthVerifierExists

    public void assertOAuthVerifierExists()
                                   throws OAuthException

  Checks to see if the OAuth Verifier exists. Throws an exception if it does not. See `getOAuthVerifier()` to learn more about this parameter.

  Throws:
    `OAuthException` - if the OAuth token secret does not exist

### getOAuthCallback

    public java.lang.String getOAuthCallback()

  Returns the OAuth callback url. The OAuth callback url is a url the Consumer provides to the Service Provider in the user authorization url. Once the user has authorized, the Service Provider will redirect the user back to the callback url with the user-authorized request token in the response. This parameter is optional.

### setOAuthCallback

    public void setOAuthCallback(java.lang.String oauthCallback)

  Sets the OAuth callback url. See `getOAuthCallback()` to learn more about this parameter.

### checkOAuthCallbackExists

    public boolean checkOAuthCallbackExists()

  Checks to see if the OAuth callback exists. See `getOAuthCallback()` to learn more about this parameter.

  Returns:
    true if the OAuth callback exists, false otherwise

### assertOAuthCallbackExists

    public void assertOAuthCallbackExists()
                                   throws OAuthException

  Checks to see if the OAuth callback exists. Throws an exception if it does not. See `getOAuthCallback()` to learn more about this parameter.

  Throws:
    `OAuthException` - if the OAuth callback does not exist

### getRealm

    public java.lang.String getRealm()

  Returns the Realm parameter to be used in the authorization header, as defined by

  ### setRealm

      public void setRealm(java.lang.String realm)

    Sets the Realm parameter. See `getRealm()` to learn more about this parameter.

  ### checkRealmExists

      public boolean checkRealmExists()

    Checks to see if the realm exists. See `getRealm()` to learn more about this parameter.

    Returns:
      true if the realm exists, false otherwise

  ### assertRealmExists

      public void assertRealmExists()
                             throws OAuthException

    Checks to see if the realm exists. Throws an exception if it does not. See `getRealm()` to learn more about this parameter.

    Throws:
      `OAuthException` - if the realm does not exist

  ### get

      protected java.lang.String get(java.lang.String key,
                                     java.util.Map<java.lang.String,java.lang.String> params)

    Retrieves the value with the given key from the input map. A null value is returned as an empty string.

    Parameters:
      `key` - the key whose value to retrieve
      `params` - the map from which to retrieve the value from
    Returns:
      the value associated with the given key

  ### put

      protected void put(java.lang.String key,
                         java.lang.String value,
                         java.util.Map<java.lang.String,java.lang.String> params)

    Adds the key/value pair to the input map.

    Parameters:
      `key` - the key to add to the map
      `value` - the value to add to the map
      `params` - the map to add the values to

  ### remove

      protected void remove(java.lang.String key,
                            java.util.Map<java.lang.String,java.lang.String> params)

    Removes a key/value pair from the input map.

    Parameters:
      `key` - the key to remove
      `params` - the map to remove the key from

  ### checkExists

      protected boolean checkExists(java.lang.String key,
                                    java.util.Map<java.lang.String,java.lang.String> params)

    Checks the given key to see if it exists. In order to "exist", the value can't be null, and it can't be an empty string.

    Parameters:
      `key` - the key to check for existence
      `params` - the map to check for the key
    Returns:
      true if the value is a string that is not empty, false otherwise

  ### assertExists

      protected void assertExists(java.lang.String key,
                                  java.util.Map<java.lang.String,java.lang.String> params)
                           throws OAuthException

    Checks the given key to see if it exists, and throws an exception if it does not. See `checkExists(java.lang.String, java.util.Map<java.lang.String, java.lang.String>)` for more information.

    Parameters:
      `key` - the key to check for existence
      `params` - the map to check for the key
    Throws:
      `OAuthException` - if the value for the given key doesn't exist