public class OAuthHmacThreeLeggedFlow implements ThreeLeggedFlow
Beta
ThreeLeggedFlow implementation that will execute the proper requests to obtain an OAuth1
Credential object that can be used to sign requests.
This class is not thread safe, nor should you attempt to execute a flow from multiple threads simultaneously.
Implements
ThreeLeggedFlowConstructors
OAuthHmacThreeLeggedFlow(String userId, String consumerKey, String consumerSecret, String authorizationServerUrl, String temporaryTokenUrl, String callbackUrl, HttpTransport transport)
public OAuthHmacThreeLeggedFlow(String userId, String consumerKey, String consumerSecret, String authorizationServerUrl, String temporaryTokenUrl, String callbackUrl, HttpTransport transport)
Create an OAuthThreeLeggedFlow instance from the required information.
Parameters | |
---|---|
Name | Description |
userId |
String Key that can be used to associate this flow with an end user. |
consumerKey |
String Key that identifies the server to the service provider. |
consumerSecret |
String Secret that is shared between the server and the service provider. |
authorizationServerUrl |
String Url with which we communicate to authorize tis application. |
temporaryTokenUrl |
String Url which we will use to obtain a temporary token. |
callbackUrl |
String Url which the server should redirect the user to after obtaining authorization. |
transport |
com.google.api.client.http.HttpTransport |
Methods
complete(String authorizationCode)
public Credential complete(String authorizationCode)
After the user has authorized the request, the token or code obtained should be passed to this complete function to allow us to exchange the code with the authentication server for a Credential.
Parameter | |
---|---|
Name | Description |
authorizationCode |
String |
Returns | |
---|---|
Type | Description |
Credential |
Exceptions | |
---|---|
Type | Description |
IOException |
getAuthorizationUrl()
public String getAuthorizationUrl()
After the object is created, the developer should use this method to interrogate it for the authorization URL to which the user should be redirected to obtain permission.
Returns | |
---|---|
Type | Description |
String |
loadCredential(PersistenceManager pm)
public Credential loadCredential(PersistenceManager pm)
Convenience function that will load a credential based on the userId for which this flow was instantiated.
Parameter | |
---|---|
Name | Description |
pm |
PersistenceManager |
Returns | |
---|---|
Type | Description |
Credential |
setHttpTransport(HttpTransport transport)
public void setHttpTransport(HttpTransport transport)
Set HttpTransport instance for this three legged flow.
Parameter | |
---|---|
Name | Description |
transport |
com.google.api.client.http.HttpTransport |
setJsonFactory(JsonFactory jsonFactory)
public void setJsonFactory(JsonFactory jsonFactory)
Set JsonFactory instance for this three legged flow.
Parameter | |
---|---|
Name | Description |
jsonFactory |
com.google.api.client.json.JsonFactory |