com.google.api.client.extensions.auth.helpers.oauth2.draft10
Class OAuth2ThreeLeggedFlow

java.lang.Object
  extended by com.google.api.client.extensions.auth.helpers.oauth2.draft10.OAuth2ThreeLeggedFlow
All Implemented Interfaces:
ThreeLeggedFlow

Deprecated. (scheduled to be removed in 1.10) Use AuthorizationCodeFlow

@Deprecated
public class OAuth2ThreeLeggedFlow
extends Object
implements ThreeLeggedFlow

This class is designed to allow the three legged web app flow for OAuth2 to be accomplished easily. When the constructor is called an authorization url is generated from the provided information. The user should be redirected to that url for confirmation. When the code has been received, the flow will request the access and refresh tokens.

It is not safe to use one instance of this implementation from multiple threads.

Since:
1.4
Author:
moshenko@google.com (Jacob Moshenko)

Constructor Summary
OAuth2ThreeLeggedFlow(String userId, String clientId, String clientSecret, String scope, String callbackUrl, String authorizationEndpoint, String tokenEndpoint)
          Deprecated. Create the flow object with the information provided and create the authorization url.
 
Method Summary
 Credential complete(String authorizationCode)
          Deprecated. 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.
 String getAuthorizationUrl()
          Deprecated. 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.
 Credential loadCredential(javax.jdo.PersistenceManager pm)
          Deprecated. Convenience function that will load a credential based on the userId for which this flow was instantiated.
 void setHttpTransport(HttpTransport transport)
          Deprecated. Set HttpTransport instance for this three legged flow.
 void setJsonFactory(JsonFactory jsonFactory)
          Deprecated. Set JsonFactory instance for this three legged flow.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OAuth2ThreeLeggedFlow

public OAuth2ThreeLeggedFlow(String userId,
                             String clientId,
                             String clientSecret,
                             String scope,
                             String callbackUrl,
                             String authorizationEndpoint,
                             String tokenEndpoint)
Deprecated. 
Create the flow object with the information provided and create the authorization url.

Parameters:
userId - Key that will be used to associate this flow object with an end user.
clientId - Used to identify the client server with the token server.
clientSecret - Secret shared between the client server and the token server.
scope - OAuth2 scope or space delimited list of scopes for which we require access.
callbackUrl - Where the authorization should redirect the user to complete the flow.
authorizationEndpoint - Server to which we will redirect the user to grant authorization.
tokenEndpoint - Server with which we will exchange an authorization code for an access token.
Method Detail

complete

public Credential complete(String authorizationCode)
                    throws IOException
Deprecated. 
Description copied from interface: ThreeLeggedFlow
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.

Specified by:
complete in interface ThreeLeggedFlow
Parameters:
authorizationCode - Code or token obtained after the user grants permission
Returns:
Credential object that is obtained from token server
Throws:
IOException - When an error occurs when communicating with the token server

getAuthorizationUrl

public String getAuthorizationUrl()
Deprecated. 
Description copied from interface: ThreeLeggedFlow
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.

Specified by:
getAuthorizationUrl in interface ThreeLeggedFlow
Returns:
URL to which the user should be directed

loadCredential

public Credential loadCredential(javax.jdo.PersistenceManager pm)
Deprecated. 
Description copied from interface: ThreeLeggedFlow
Convenience function that will load a credential based on the userId for which this flow was instantiated.

Specified by:
loadCredential in interface ThreeLeggedFlow
Parameters:
pm - PersistenceManager instance which this flow should use to interact with the data store. The caller must remember to call PersistenceManager.close() after this method returns.
Returns:
Fully initialized Credential object or null if none exists.

setHttpTransport

public void setHttpTransport(HttpTransport transport)
Deprecated. 
Description copied from interface: ThreeLeggedFlow
Set HttpTransport instance for this three legged flow.

Specified by:
setHttpTransport in interface ThreeLeggedFlow

setJsonFactory

public void setJsonFactory(JsonFactory jsonFactory)
Deprecated. 
Description copied from interface: ThreeLeggedFlow
Set JsonFactory instance for this three legged flow.

Specified by:
setJsonFactory in interface ThreeLeggedFlow


Copyright © 2011-2012 Google. All Rights Reserved.