Class AbstractCallbackServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- com.google.api.client.extensions.servlet.auth.AbstractCallbackServlet
-
- All Implemented Interfaces:
java.io.Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
@Beta public abstract class AbstractCallbackServlet extends javax.servlet.http.HttpServletBeta
Callback that will retrieve and complete aThreeLeggedFlowwhen 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
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringcompletionCodeQueryParamprivate java.lang.StringdeniedRedirectUrlprivate static java.lang.StringERROR_PARAMprivate java.lang.Class<? extends ThreeLeggedFlow>flowTypeprivate com.google.api.client.http.HttpTransporthttpTransportprivate com.google.api.client.json.JsonFactoryjsonFactoryprivate static java.util.logging.LoggerLOGprivate javax.jdo.PersistenceManagerFactorypmfprivate java.lang.StringredirectUrlprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description AbstractCallbackServlet()Constructor with will ask the concrete subclass for all required information on the environment.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)protected abstract java.lang.StringgetCompletionCodeQueryParam()protected abstract java.lang.Class<? extends ThreeLeggedFlow>getConcreteFlowType()protected abstract java.lang.StringgetDeniedRedirectUrl()protected com.google.api.client.http.HttpTransportgetHttpTransport()Return theHttpTransportinstance for this servlet.protected com.google.api.client.json.JsonFactorygetJsonFactory()Return theJsonFactoryinstance for this servlet.protected abstract javax.jdo.PersistenceManagerFactorygetPersistenceManagerFactory()Override with your chosen method to get a PersistenceManagerFactory.protected abstract java.lang.StringgetSuccessRedirectUrl()protected abstract java.lang.StringgetUserId()protected abstract com.google.api.client.http.HttpTransportnewHttpTransportInstance()Create a newHttpTransportinstance.protected abstract com.google.api.client.json.JsonFactorynewJsonFactoryInstance()Create a newJsonFactoryinstance.-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
LOG
private static final java.util.logging.Logger LOG
-
ERROR_PARAM
private static final java.lang.String ERROR_PARAM
- See Also:
- Constant Field Values
-
pmf
private javax.jdo.PersistenceManagerFactory pmf
-
flowType
private java.lang.Class<? extends ThreeLeggedFlow> flowType
-
redirectUrl
private java.lang.String redirectUrl
-
deniedRedirectUrl
private java.lang.String deniedRedirectUrl
-
completionCodeQueryParam
private java.lang.String completionCodeQueryParam
-
httpTransport
private final com.google.api.client.http.HttpTransport httpTransport
-
jsonFactory
private final com.google.api.client.json.JsonFactory jsonFactory
-
-
Method Detail
-
getJsonFactory
protected final com.google.api.client.json.JsonFactory getJsonFactory()
Return theJsonFactoryinstance for this servlet.
-
getHttpTransport
protected final com.google.api.client.http.HttpTransport getHttpTransport()
Return theHttpTransportinstance 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 java.lang.Class<? extends ThreeLeggedFlow> getConcreteFlowType()
- Returns:
- Specific ThreeLeggedFlow type that this callback should retreieve and complete.
-
getSuccessRedirectUrl
protected abstract java.lang.String getSuccessRedirectUrl()
- Returns:
- Url to redirect the user to upon a successful credential exchange.
-
getDeniedRedirectUrl
protected abstract java.lang.String getDeniedRedirectUrl()
- Returns:
- Url to redirect the user to upon failure.
-
getCompletionCodeQueryParam
protected abstract java.lang.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 java.lang.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 com.google.api.client.http.HttpTransport newHttpTransportInstance()
Create a newHttpTransportinstance. Implementations can create any type of applicable transport and should be as simple as:new NetHttpTransport();
- Returns:
HttpTransportinstance for your particular environment
-
newJsonFactoryInstance
protected abstract com.google.api.client.json.JsonFactory newJsonFactoryInstance()
Create a newJsonFactoryinstance. Implementations can create any type of applicable json factory and should be as simple as:new JacksonFactory();
- Returns:
JsonFactoryinstance for your particular environment
-
doGet
protected final void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws java.io.IOException, javax.servlet.ServletException- Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
-