我已经完成了自定义自动登录过滤器,但是当Liferay重定向到主页面时(一旦用户通过身份验证),登录portlet会显示一个我无法理解的错误。
错误显示“您的请求未能完成”,但用户已成功登录,如果我按F5或浏览页面,则错误消失。
我的Autologin类实现是:
public String[] login(HttpServletRequest request,
HttpServletResponse response) throws AutoLoginException {
String[] credentials = new String[3];
String p_id = request.getParameter("p_p_id");
String userName = null;
String password = null;
if (p_id != null) {
userName = request.getParameter("_" + p_id + "_login");
password = request.getParameter("_" + p_id + "_password");
//Custom authentication code required [...]
}
if (userName != null) {
// New Login
try {
//We log as Test user...just for TEST
long companyId = PortalUtil.getCompanyId(request);
User user = UserLocalServiceUtil.getUserByScreenName(companyId, "Test");
long userId = user.getUserId();
String userPwd = user.getPassword();
credentials[0] = Long.toString(userId);
credentials[1] = userPwd;
credentials[2] = Boolean.FALSE.toString();
} catch (Exception e) {
e.printStackTrace();
throw new AutoLoginException(e);
}
return credentials;
}
return credentials;
}
我还实现了一个自定义身份验证器,它始终返回SUCCESS。
你对我做错了什么了解吗?
非常感谢你!
Ivan fontanals