}
public ActionForward returnFromPeps(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
AttributesManagement attrManagement = null;
try {
String memcachedCode = request.getParameter("key");
MemcachedClient c =
new MemcachedClient(new InetSocketAddress(SPUtil.getInstance().getMemcachedHostname(), SPUtil.getInstance()
.getMemcachedPort()));
String attrList = null;
if (!StringUtils.isEmpty((String) request.getAttribute("storkTestAttrList"))) {
attrList = (String) request.getAttribute("storkTestAttrList");
} else {
attrList = (String) c.get(memcachedCode);
}
if (StringUtils.isEmpty(attrList)) {
return mapping.findForward("stork-error-authentication-failed");
}
attrManagement = new AttributesManagement(attrList);
if (StringUtils.isEmpty(attrManagement.getStorkReturnCode())
|| !AttributesManagement.STORK_RETURN_CODE_OK.equals(attrManagement.getStorkReturnCode())) {
String errorCode = attrManagement.getStorkErrorCode();
String errorMessage = attrManagement.getStorkErrorMessage();
Exception e =
new Exception(String.format("Error on stork authentication method, Error: %s, Description: %s",
errorCode, errorMessage));
logger.error(e.getMessage(), e);
return mapping.findForward("stork-error-authentication-failed");
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
return mapping.findForward("stork-error-authentication-failed");
}
String eIdentifier = attrManagement.getEIdentifier();
ActionForward actionForwardError = verifySubmissionPreconditions(mapping);
if (actionForwardError != null) {
return actionForwardError;
}