public class OpenIDClientServlet
extends javax.servlet.http.HttpServlet
This design allows the application code to be separated from OpenID specific code. All the application needs to do is create an OpenIDAuthRequest, put it into the request, and forward control to this servlet.
The OpenID provider will take it's time to verify the authentication, eg. allow the user to login, select a profile, etc. Once this is complete, the OpenID server will asynchronously respond to the authentication request and will redirect an authentication response to this servlet.
This servlet will then receive the response from the OpenID Provider, build an OpenIDAuthResponse object and forward control back to the application. The application can process the OpenIDAuthResponse and create an OpenIDPrincipal from it if required.
The application will need to implement a Servlet/Action/etc to make the authentication request (eg. Login action) and one to process the authentication response (eg. LoginResponse action). It has been done this way for clarity, however, it could easily be refactored into one action.
Constructor and Description |
---|
OpenIDClientServlet() |
Modifier and Type | Method and Description |
---|---|
protected void |
doGet(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
Forward to doPost().
|
protected void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
The servlet is used to both send requests and recieve responses.
|
void |
init(javax.servlet.ServletConfig config)
Initialise the servlet to inject the CrowdConsumer from Spring.
|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
config
- ServletConfigjavax.servlet.ServletException
protected void doGet(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) throws javax.servlet.ServletException, IOException
doGet
in class javax.servlet.http.HttpServlet
httpServletRequest
- httpServletRequesthttpServletResponse
- httpServletResponsejavax.servlet.ServletException
IOException
protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
doPost
in class javax.servlet.http.HttpServlet
request
- httpServletRequestresponse
- httpServletResponsejavax.servlet.ServletException
IOException
Copyright © 2021 Atlassian. All rights reserved.