Class OAuthHmacThreeLeggedFlow (1.33.3)

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.

Inheritance

java.lang.Object > OAuthHmacThreeLeggedFlow

Implements

ThreeLeggedFlow

Constructors

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
NameDescription
userIdString

Key that can be used to associate this flow with an end user.

consumerKeyString

Key that identifies the server to the service provider.

consumerSecretString

Secret that is shared between the server and the service provider.

authorizationServerUrlString

Url with which we communicate to authorize tis application.

temporaryTokenUrlString

Url which we will use to obtain a temporary token.

callbackUrlString

Url which the server should redirect the user to after obtaining authorization.

transportcom.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
NameDescription
authorizationCodeString
Returns
TypeDescription
Credential
Exceptions
TypeDescription
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
TypeDescription
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
NameDescription
pmPersistenceManager
Returns
TypeDescription
Credential

setHttpTransport(HttpTransport transport)

public void setHttpTransport(HttpTransport transport)

Set HttpTransport instance for this three legged flow.

Parameter
NameDescription
transportcom.google.api.client.http.HttpTransport

setJsonFactory(JsonFactory jsonFactory)

public void setJsonFactory(JsonFactory jsonFactory)

Set JsonFactory instance for this three legged flow.

Parameter
NameDescription
jsonFactorycom.google.api.client.json.JsonFactory