com.google.api.client.extensions.servlet.auth
Class AbstractFlowUserServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.google.api.client.extensions.servlet.auth.AbstractFlowUserServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public abstract class AbstractFlowUserServlet
extends javax.servlet.http.HttpServlet

Servlet that can be used to invoke and manage a ThreeLeggedFlow object in the App Engine container. Developers should subclass this to provide the necessary information for their specific use case.

Warning: starting with version 1.7, usage of this for OAuth 2.0 is deprecated. Instead use AbstractAuthorizationCodeServlet.

Since:
1.4
Author:
moshenko@google.com (Jacob Moshenko)
See Also:
Serialized Form

Constructor Summary
AbstractFlowUserServlet()
           
 
Method Summary
protected  Credential getCredential(javax.servlet.http.HttpServletRequest req)
          Fetch a credential associated with this request.
protected  HttpTransport getHttpTransport()
          Return the HttpTransport instance for this servlet.
protected  JsonFactory getJsonFactory()
          Return the JsonFactory instance for this servlet.
protected abstract  javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
          Obtain a PersistenceManagerFactory for working with the datastore.
protected abstract  String getUserId()
           
protected abstract  ThreeLeggedFlow newFlow(String userId)
          Create a flow object which will be used to obtain credentials.
protected abstract  HttpTransport newHttpTransportInstance()
          Create a new HttpTransport instance.
protected abstract  JsonFactory newJsonFactoryInstance()
          Create a new JsonFactory instance.
protected  void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFlowUserServlet

public AbstractFlowUserServlet()
Method Detail

service

protected void service(javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse resp)
                throws IOException,
                       javax.servlet.ServletException
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
IOException
javax.servlet.ServletException

getCredential

protected Credential getCredential(javax.servlet.http.HttpServletRequest req)
Fetch a credential associated with this request.

Parameters:
req - Request object to use as context for fetching the credential.
Returns:
Credential object for this request and user.
Since:
1.5

getJsonFactory

protected final JsonFactory getJsonFactory()
Return the JsonFactory instance for this servlet.


getHttpTransport

protected final HttpTransport getHttpTransport()
Return the HttpTransport instance for this servlet.


getPersistenceManagerFactory

protected abstract javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
Obtain a PersistenceManagerFactory for working with the datastore.

Returns:
PersistenceManagerFactory instance.

newFlow

protected abstract ThreeLeggedFlow newFlow(String userId)
                                    throws IOException
Create a flow object which will be used to obtain credentials.

Parameters:
userId - User id to be passed to the constructor of the flow object
Returns:
Flow object used to obtain credentials
Throws:
IOException

newHttpTransportInstance

protected abstract HttpTransport newHttpTransportInstance()
Create a new HttpTransport instance. Implementations can create any type of applicable transport and should be as simple as:
  new NetHttpTransport();
 

Returns:
HttpTransport instance for your particular environment

newJsonFactoryInstance

protected abstract JsonFactory newJsonFactoryInstance()
Create a new JsonFactory instance. Implementations can create any type of applicable json factory and should be as simple as:
  new JacksonFactory();
 

Returns:
JsonFactory instance for your particular environment

getUserId

protected abstract String getUserId()
Returns:
Get a string representation of a userId that can be used to associate credentials and flows with a specific user.


Copyright © 2011-2012 Google. All Rights Reserved.