* @throws IdentityException
*/
public String processRequest(HttpServletRequest request, HttpServletResponse response)
throws IdentityException {
ParameterList paramList = null;
String responseText = null;
HttpSession session = null;
OpenIDAdminClient client = null;
String cookie = null;
ConfigurationContext configContext = null;
String serverURL = null;
if (request == null || response == null) {
throw new IdentityException("Required attributes missing");
}
try {
session = request.getSession();
serverURL = CarbonUIUtil.getServerURL(session.getServletContext(), session);
configContext = (ConfigurationContext) session.getServletContext().getAttribute(
CarbonConstants.CONFIGURATION_CONTEXT);
cookie = (String) session.getAttribute(OpenIDAdminClient.OPENID_ADMIN_COOKIE);
client = new OpenIDAdminClient(configContext, serverURL, cookie);
if (OpenId.COMPLETE.equals(session.getAttribute(OpenId.ACTION))
|| OpenId.CANCEL.equals(session.getAttribute(OpenId.ACTION))) {
// Ready for authentication.
paramList = (ParameterList) session.getAttribute(OpenId.PARAM_LIST);
} else {
// Extract the parameters from the request.Authentication not
// completed.
paramList = new ParameterList(request.getParameterMap());
}
if (paramList == null) {
responseText = getErrorResponseText("Invalid OpenID authentication request");
if (log.isDebugEnabled()) {
log.debug("Invalid OpenID authentication request :" + responseText);
}
directResponse(response, responseText);
return null;
}
String mode = paramList.hasParameter(OpenId.ATTR_MODE) ? paramList
.getParameterValue(OpenId.ATTR_MODE) : null;
if (log.isDebugEnabled()) {
log.debug("OpenID authentication mode :" + mode);
}