public class

TwoLeggedOAuthHelper

extends Object
java.lang.Object
   ↳ com.google.gdata.client.authn.oauth.TwoLeggedOAuthHelper

Class Overview

Provides common OAuth message signing and Authorization header functionality.

Summary

Fields
private final OAuthParameters parameters
private final OAuthSigner signer
Public Constructors
TwoLeggedOAuthHelper(OAuthSigner signer, OAuthParameters parameters)
Public Methods
String getAuthorizationHeader(String requestUrl, String httpMethod)
Generates the string to be used as the HTTP authorization header.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private final OAuthParameters parameters

private final OAuthSigner signer

Public Constructors

public TwoLeggedOAuthHelper (OAuthSigner signer, OAuthParameters parameters)

Parameters
signer
parameters

Public Methods

public String getAuthorizationHeader (String requestUrl, String httpMethod)

Generates the string to be used as the HTTP authorization header. A typical authorization header will look something like this:

OAuth realm="", oauth_signature="SOME_LONG_STRING", oauth_nonce="123456", oauth_signature_method="RSA-SHA1", oauth_consumer_key="www.example.com", oauth_token="abc123", oauth_timestamp="123456"

The following parameters are required in OAuthParameters:

  • oauth_consumer_key
  • oauth_token
  • oauth_token_secret (if signing with HMAC)

Parameters
requestUrl The url of the request
httpMethod The http method of the request (for example GET)
Returns
  • the full authorization header
Throws
OAuthException if there is an error with the OAuth request