String userEntry = req.getParameter("openid");
OpenIDRequest openIDReq = new OpenIDRequest(userEntry);
HttpSession session = req.getSession();
OpenIDManager manager = (OpenIDManager) session.getAttribute("openid_manager");
if(manager == null)
{
manager = new OpenIDManager(openIDReq);
session.setAttribute("openid_manager", manager);
}
try
{
OpenIDProviderList listOfProviders = manager.discoverProviders();
HTTPOpenIDContext httpOpenIDCtx = new HTTPOpenIDContext(req,resp, this.servletContext);
httpOpenIDCtx.setReturnURL(returnURL);
HTTPProtocolAdaptor adapter = new HTTPProtocolAdaptor(httpOpenIDCtx);
OpenIDProviderInformation providerInfo = manager.associate(adapter, listOfProviders);
manager.authenticate(adapter, providerInfo);
}
catch (OpenIDGeneralException e)
{
log("[OpenIDConsumerServlet]Exception in dealing with the provider:",e);
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);