Class OAuthParameters (1.34.1)

public final class OAuthParameters implements HttpExecuteInterceptor, HttpRequestInitializer

Beta
OAuth 1.0a parameter manager.

The only required non-computed fields are #signer and #consumerKey. Use #token to specify token or temporary credentials.

Sample usage, taking advantage that this class implements HttpRequestInitializer:

public static HttpRequestFactory createRequestFactory(HttpTransport transport) { OAuthParameters parameters = new OAuthParameters(); // ... return transport.createRequestFactory(parameters); }

If you have a custom request initializer, take a look at the sample usage for HttpExecuteInterceptor, which this class also implements.

Inheritance

java.lang.Object > OAuthParameters

Implements

com.google.api.client.http.HttpExecuteInterceptor, com.google.api.client.http.HttpRequestInitializer

Static Methods

escape(String value)

public static String escape(String value)

Returns the escaped form of the given value using OAuth escaping rules.

Parameter
NameDescription
valueString
Returns
TypeDescription
String

Constructors

OAuthParameters()

public OAuthParameters()

Fields

callback

public String callback

Absolute URI back to which the server will redirect the resource owner when the Resource Owner Authorization step is completed.

Field Value
TypeDescription
String

consumerKey

public String consumerKey

Required identifier portion of the client credentials (equivalent to a username).

Field Value
TypeDescription
String

nonce

public String nonce

Required nonce value. Should be computed using #computeNonce().

Field Value
TypeDescription
String

realm

public String realm

Realm.

Field Value
TypeDescription
String

signature

public String signature

Signature. Required but normally computed using #computeSignature.

Field Value
TypeDescription
String

signatureMethod

public String signatureMethod

Name of the signature method used by the client to sign the request. Required, but normally computed using #computeSignature.

Field Value
TypeDescription
String

signer

public OAuthSigner signer

Required OAuth signature algorithm.

Field Value
TypeDescription
OAuthSigner

timestamp

public String timestamp

Required timestamp value. Should be computed using #computeTimestamp().

Field Value
TypeDescription
String

token

public String token

Token value used to associate the request with the resource owner or null if the request is not associated with a resource owner.

Field Value
TypeDescription
String

verifier

public String verifier

The verification code received from the server.

Field Value
TypeDescription
String

version

public String version

Must either be "1.0" or null to skip. Provides the version of the authentication process as defined in this specification.

Field Value
TypeDescription
String

Methods

computeNonce()

public void computeNonce()

Computes a nonce based on the hex string of a random non-negative long, setting the value of the #nonce field.

computeSignature(String requestMethod, GenericUrl requestUrl)

public void computeSignature(String requestMethod, GenericUrl requestUrl)

Computes a new signature based on the fields and the given request method and URL, setting the values of the #signature and #signatureMethod fields.

Parameters
NameDescription
requestMethodString
requestUrlcom.google.api.client.http.GenericUrl
Exceptions
TypeDescription
GeneralSecurityException

general security exception

computeTimestamp()

public void computeTimestamp()

Computes a timestamp based on the current system time, setting the value of the #timestamp field.

getAuthorizationHeader()

public String getAuthorizationHeader()

Returns the Authorization header value to use with the OAuth parameter values found in the fields.

Returns
TypeDescription
String

initialize(HttpRequest request)

public void initialize(HttpRequest request)
Parameter
NameDescription
requestcom.google.api.client.http.HttpRequest
Exceptions
TypeDescription
IOException

intercept(HttpRequest request)

public void intercept(HttpRequest request)
Parameter
NameDescription
requestcom.google.api.client.http.HttpRequest
Exceptions
TypeDescription
IOException