| java.lang.Object | |
| ↳ | com.google.gdata.client.authn.oauth.OAuthHelper |
Known Direct Subclasses
|
Helper methods to support the entire OAuth lifecycle, including generating the user authorization url, exchanging the user authenticated request token for an access token, and generating the Authorization http header.
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| accessTokenUrl | |||||||||||
| httpClient | |||||||||||
| requestTokenUrl | |||||||||||
| revokeTokenUrl | |||||||||||
| signer | |||||||||||
| userAuthorizationUrl | |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Create a new
OAuthHelper object. | |||||||||||
Create a new
OAuthHelper object. | |||||||||||
Create a new
OAuthHelper object. | |||||||||||
Create a new
OAuthHelper object. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Generates the url which the user should visit in order to authenticate and
authorize with the Service Provider.
| |||||||||||
Exchanges the user-authorized request token for an access token.
| |||||||||||
Exchanges the user-authorized request token for an access token.
| |||||||||||
Exchanges the user-authorized request token for an access token.
| |||||||||||
Get the access token url
| |||||||||||
Generates the string to be used as the HTTP authorization header.
| |||||||||||
Helper method which parses a url for the OAuth related parameters.
| |||||||||||
Helper method which parses a querystring for the OAuth related parameters.
| |||||||||||
Returns a properly formatted and signed OAuth request url, with the
appropriate parameters.
| |||||||||||
Get the request token url
| |||||||||||
Get the revoke token url
| |||||||||||
Retrieves the unauthorized request token and token secret from the remote
server and sets the parameters in the
OAuthParameters object. | |||||||||||
This method is deprecated.
Call a combination of
getUnauthorizedRequestToken(OAuthParameters) and
createUserAuthorizationUrl(OAuthParameters) instead.
| |||||||||||
Get the user authorization url
| |||||||||||
Revokes the user's OAuth token.
| |||||||||||
Set the access token url
| |||||||||||
Set the request token url
| |||||||||||
Set the revoke token url
| |||||||||||
Set the user authorization url
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Create a new OAuthHelper object.
| requestTokenUrl | The url used to obtain an unauthorized request token |
|---|---|
| userAuthorizationUrl | The url used to obtain user authorization for consumer access |
| accessTokenUrl | The url used to exchange the user-authorized request token for an access token |
| signer | The OAuthSigner to use when signing the request
|
Create a new OAuthHelper object. This version of the constructor
is primarily for testing purposes, where a mocked OAuthHttpClient
and OAuthSigner can be specified.
| requestTokenUrl | The url used to obtain an unauthorized request token |
|---|---|
| userAuthorizationUrl | The url used to obtain user authorization for consumer access |
| accessTokenUrl | The url used to exchange the user-authorized request token for an access token |
| signer | The OAuthSigner to use when signing the request |
| httpClient | The OAuthHttpClient to use when making http
requests
|
Create a new OAuthHelper object.
| requestTokenUrl | The url used to obtain an unauthorized request token |
|---|---|
| userAuthorizationUrl | The url used to obtain user authorization for consumer access |
| accessTokenUrl | The url used to exchange the user-authorized request token for an access token |
| revokeTokenUrl | The url used to revoke the OAuth token |
| signer | The OAuthSigner to use when signing the request
|
Create a new OAuthHelper object. This version of the constructor
is primarily for testing purposes, where a mocked OAuthHttpClient
and OAuthSigner can be specified.
| requestTokenUrl | The url used to obtain an unauthorized request token |
|---|---|
| userAuthorizationUrl | The url used to obtain user authorization for consumer access |
| accessTokenUrl | The url used to exchange the user-authorized request token for an access token |
| revokeTokenUrl | The url used to revoke the OAuth token |
| signer | The OAuthSigner to use when signing the request |
| httpClient | The OAuthHttpClient to use when making http
requests
|
Generates the url which the user should visit in order to authenticate and
authorize with the Service Provider. This method does not modify the
OAuthParameters object. The url will look something like this:
https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=[OAUTHTOKENSTRING]&oauth_callback=http%3A%2F%2Fwww.google.com%2F
The following parameter is required in OAuthParameters:
The following parameter is optional:
| oauthParameters | The OAuth parameters necessary for this request |
|---|
Exchanges the user-authorized request token for an access token. Typically, this method is called immediately after you extract the user-authorized request token from the authorization response, but it can also be triggered by a user action indicating they've successfully completed authorization with the service provider.
The following parameters are required in OAuthParameters:
If the request is successful, the following parameters will be set in
OAuthParameters:
| oauthParameters | OAuth parameters for this request |
|---|
| OAuthException | if there is an error with the OAuth request |
|---|
Exchanges the user-authorized request token for an access token. This
method parses the user-authorized request token from the authorization
response's query string, and passes it on to
getAccessToken(OAuthParameters) (The query string is everything
in the authorization response URL after the question mark).
The following parameters are required in OAuthParameters:
| queryString | The query string containing the request token |
|---|---|
| oauthParameters | OAuth parameters for this request |
| OAuthException | if there is an error with the OAuth request |
|---|
Exchanges the user-authorized request token for an access token. This
method parses the user-authorized request token from the authorization
response url, and passes it on to
getAccessToken(String, OAuthParameters).
The following parameters are required in OAuthParameters:
| url | The url to parse the request token from |
|---|---|
| oauthParameters | OAuth parameters for this request |
| OAuthException | if there is an error with the OAuth request |
|---|
Get the access token url
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:
| requestUrl | The url of the request |
|---|---|
| httpMethod | The http method of the request (for example GET) |
| oauthParameters | OAuth parameters for this request |
| OAuthException | if there is an error with the OAuth request |
|---|
Helper method which parses a url for the OAuth related parameters.
It expects an OAuth token parameter to exist, while the OAuth token secret
may or may not exist, depending on the implementation. The parameters are
set in the OAuthParameters object.
| url | The url containing the OAuth parameters. |
|---|---|
| oauthParameters | OAuth parameters for this request |
Helper method which parses a querystring for the OAuth related parameters.
It expects an OAuth token parameter to exist, while the OAuth token secret
may or may not exist, depending on the implementation. The parameters are
set in the OAuthParameters object.
| queryString | The query string containing the OAuth parameters |
|---|---|
| oauthParameters | OAuth parameters for this request |
Returns a properly formatted and signed OAuth request url, with the appropriate parameters.
| baseUrl | The url to make the request to |
|---|---|
| httpMethod | The http method of this request (for example, "GET") |
| oauthParameters | OAuth parameters for this request |
| OAuthException | if there is an error with the OAuth request |
|---|
Get the request token url
Get the revoke token url
Retrieves the unauthorized request token and token secret from the remote
server and sets the parameters in the OAuthParameters object.
The following parameter is required in OAuthParameters:
If the request is successful, the following parameters will be set in
OAuthParameters:
| oauthParameters | The OAuth parameters necessary for this request. |
|---|
| OAuthException | if there is an error with the OAuth request |
|---|
This method is deprecated.
Call a combination of getUnauthorizedRequestToken(OAuthParameters) and
createUserAuthorizationUrl(OAuthParameters) instead.
Generates the url which the user should visit in order to authenticate and
authorize with the Service Provider. The url will look something like this:
https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=[OAUTHTOKENSTRING]&oauth_callback=http%3A%2F%2Fwww.google.com%2F
This method first calls
getUnauthorizedRequestToken(OAuthParameters) to retrieve the
unauthorized request token, and then calls
createUserAuthorizationUrl(OAuthParameters). Users who wish to
add a token secret to the callback url should call
getUnauthorizedRequestToken(OAuthParameters) first, append the
retrieved token secret to the callback url, and then call
createUserAuthorizationUrl(OAuthParameters).
The following parameter is required in OAuthParameters:
The following parameter is optional:
| oauthParameters | The OAuth parameters necessary for this request |
|---|
| OAuthException | if there is an error with the OAuth request |
|---|
Get the user authorization url
Revokes the user's OAuth token. The following parameters are required in
OAuthParameters:
| oauthParameters | OAuth parameters for this request. |
|---|
| OAuthException | if there is an error with the OAuth request |
|---|
Set the access token url
| url |
|---|
Set the request token url
| url |
|---|
Set the revoke token url
| url |
|---|
Set the user authorization url
| url |
|---|