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

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

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

Callback that will retrieve and complete a ThreeLeggedFlow when redirected to by a token server or service provider. Developer should subclass to provide the necessary information tailored to their specific use case.

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

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

Constructor Summary
AbstractCallbackServlet()
          Constructor with will ask the concrete subclass for all required information on the environment.
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected abstract  String getCompletionCodeQueryParam()
           
protected abstract  Class<? extends ThreeLeggedFlow> getConcreteFlowType()
           
protected abstract  String getDeniedRedirectUrl()
           
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()
          Override with your chosen method to get a PersistenceManagerFactory.
protected abstract  String getSuccessRedirectUrl()
           
protected abstract  String getUserId()
           
protected abstract  HttpTransport newHttpTransportInstance()
          Create a new HttpTransport instance.
protected abstract  JsonFactory newJsonFactoryInstance()
          Create a new JsonFactory instance.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, 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

AbstractCallbackServlet

public AbstractCallbackServlet()
Constructor with will ask the concrete subclass for all required information on the environment.

Method Detail

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()
Override with your chosen method to get a PersistenceManagerFactory. For app engine applications this should be a singleton.

Returns:
PersistenceManagerFactory instance.

getConcreteFlowType

protected abstract Class<? extends ThreeLeggedFlow> getConcreteFlowType()
Returns:
Specific ThreeLeggedFlow type that this callback should retreieve and complete.

getSuccessRedirectUrl

protected abstract String getSuccessRedirectUrl()
Returns:
Url to redirect the user to upon a successful credential exchange.

getDeniedRedirectUrl

protected abstract String getDeniedRedirectUrl()
Returns:
Url to redirect the user to upon failure.

getCompletionCodeQueryParam

protected abstract String getCompletionCodeQueryParam()
Returns:
Specific query parameter keyword to key off of to get completion code. (e.g. "code" for OAuth2 and "verifier" for OAuth1)

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.

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

doGet

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


Copyright © 2011-2012 Google. All Rights Reserved.