public final class OAuthParameters implements HttpExecuteInterceptor, HttpRequestInitializerBeta
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.
Implements
com.google.api.client.http.HttpExecuteInterceptor, com.google.api.client.http.HttpRequestInitializerConstructors
OAuthParameters()
public OAuthParameters()Fields
callback
public String callbackAbsolute URI back to which the server will redirect the resource owner when the Resource Owner Authorization step is completed.
| Type | Description |
| String |
consumerKey
public String consumerKeyRequired identifier portion of the client credentials (equivalent to a username).
| Type | Description |
| String |
nonce
public String nonceRequired nonce value. Should be computed using #computeNonce().
| Type | Description |
| String |
realm
public String realmRealm.
| Type | Description |
| String |
signature
public String signatureSignature. Required but normally computed using #computeSignature.
| Type | Description |
| String |
signatureMethod
public String signatureMethodName of the signature method used by the client to sign the request. Required, but normally computed using #computeSignature.
| Type | Description |
| String |
signer
public OAuthSigner signerRequired OAuth signature algorithm.
| Type | Description |
| OAuthSigner |
timestamp
public String timestampRequired timestamp value. Should be computed using #computeTimestamp().
| Type | Description |
| String |
token
public String tokenToken value used to associate the request with the resource owner or null if the
request is not associated with a resource owner.
| Type | Description |
| String |
verifier
public String verifierThe verification code received from the server.
| Type | Description |
| String |
version
public String versionMust either be "1.0" or null to skip. Provides the version of the authentication
process as defined in this specification.
| Type | Description |
| 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.
| Name | Description |
| requestMethod | String |
| requestUrl | com.google.api.client.http.GenericUrl |
| Type | Description |
| GeneralSecurityException | general security exception |
computeTimestamp()
public void computeTimestamp()Computes a timestamp based on the current system time, setting the value of the #timestamp field.
escape(String value)
public static String escape(String value)Returns the escaped form of the given value using OAuth escaping rules.
| Name | Description |
| value | String |
| Type | Description |
| String |
getAuthorizationHeader()
public String getAuthorizationHeader()Returns the Authorization header value to use with the OAuth parameter values found in
the fields.
| Type | Description |
| String |
initialize(HttpRequest request)
public void initialize(HttpRequest request)| Name | Description |
| request | com.google.api.client.http.HttpRequest |
| Type | Description |
| IOException |
intercept(HttpRequest request)
public void intercept(HttpRequest request)| Name | Description |
| request | com.google.api.client.http.HttpRequest |
| Type | Description |
| IOException |