|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.client.authn.oauth.OAuthHelper
public class OAuthHelper
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.
Constructor Summary | |
---|---|
OAuthHelper(java.lang.String requestTokenUrl,
java.lang.String userAuthorizationUrl,
java.lang.String accessTokenUrl,
OAuthSigner signer)
Create a new OAuthHelper object. |
Method Summary | |
---|---|
java.lang.String |
getAccessToken(OAuthParameters oauthParameters)
Exchanges the user-authorized request token for an access token. |
java.lang.String |
getAccessToken(java.lang.String queryString,
OAuthParameters oauthParameters)
Exchanges the user-authorized request token for an access token. |
java.lang.String |
getAccessToken(java.net.URL url,
OAuthParameters oauthParameters)
Exchanges the user-authorized request token for an access token. |
java.lang.String |
getAccessTokenUrl()
Get the access token url |
java.lang.String |
getAuthorizationHeader(java.lang.String requestUrl,
java.lang.String httpMethod,
OAuthParameters oauthParameters)
Generates the string to be used as the HTTP authorization header. |
java.lang.String |
getRequestTokenUrl()
Get the request token url |
java.lang.String |
getUserAuthorizationUrl()
Get the user authorization url |
java.lang.String |
getUserAuthorizationUrl(OAuthParameters oauthParameters)
Generates the url which the user should visit in order to authenticate and authorize with the Service Provider. |
void |
setAccessTokenUrl(java.lang.String url)
Set the access token url |
void |
setRequestTokenUrl(java.lang.String url)
Set the request token url |
void |
setUserAuthorizationUrl(java.lang.String url)
Set the user authorization url |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OAuthHelper(java.lang.String requestTokenUrl, java.lang.String userAuthorizationUrl, java.lang.String accessTokenUrl, OAuthSigner signer)
OAuthHelper
object.
requestTokenUrl
- the url used to obtain an unauthorized request tokenuserAuthorizationUrl
- the url used to obtain user authorization for
consumer accessaccessTokenUrl
- the url used to exchange the user-authorized request
token for an access tokensigner
- the OAuthSigner
to use when signing the requestMethod Detail |
---|
public java.lang.String getAccessTokenUrl()
public void setAccessTokenUrl(java.lang.String url)
public java.lang.String getRequestTokenUrl()
public void setRequestTokenUrl(java.lang.String url)
public java.lang.String getUserAuthorizationUrl()
public void setUserAuthorizationUrl(java.lang.String url)
public java.lang.String getUserAuthorizationUrl(OAuthParameters oauthParameters) throws OAuthException
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 requestpublic java.lang.String getAccessToken(java.net.URL url, OAuthParameters oauthParameters) throws OAuthException
getAccessToken(String, OAuthParameters)
.
The following parameters are required in OAuthParameters
:
url
- the url to parse the request token fromoauthParameters
- OAuth parameters for this request
OAuthException
- if there is an error with the OAuth requestpublic java.lang.String getAccessToken(java.lang.String queryString, OAuthParameters oauthParameters) throws OAuthException
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 tokenoauthParameters
- OAuth parameters for this request
OAuthException
- if there is an error with the OAuth requestpublic java.lang.String getAccessToken(OAuthParameters oauthParameters) throws OAuthException
The following parameters are required in OAuthParameters
:
oauthParameters
- OAuth parameters for this request
OAuthException
- if there is an error with the OAuth requestpublic java.lang.String getAuthorizationHeader(java.lang.String requestUrl, java.lang.String httpMethod, OAuthParameters oauthParameters) throws OAuthException
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 requesthttpMethod
- 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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |