Liferay-自动登录挂钩/Portlet不会注销当前用户 [英] Liferay - autologin hook/portlet doesn't logout the current user

查看:82
本文介绍了Liferay-自动登录挂钩/Portlet不会注销当前用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎Liferay的自动登录挂钩没有注销当前用户.因此,我尝试通过以下方法调用以编程方式进行操作:

It seems Liferay's autologin hook doesn't logout the current user. So I tried to do it programmatically with the following method call:

request.getSession().invalidate();

但没有成功.自动登录挂钩是否有相同的问题?

but with no success.Does anyone had the same issues with the auto-login hook ?

推荐答案

主要问题是,如果用户登录,则不会执行自动登录过滤器,因此您无法在其中执行任何注销操作.

The main problem is that if a user is logged in, an autologin filter is not executed, so you can't do any logout action in it.

对于我的解决方案,我创建了一个servlet过滤器,该过滤器检查一些参数以进行自动登录并执行注销过程.要创建过滤器,请遵循以下指南: http://www. liferaysavvy.com/2016/02/liferay-servlet-filter-hooks.html

For my solution I created a servlet filter which check some paramteres for autologin and execute logout process. For creating a filter I follow this guide: http://www.liferaysavvy.com/2016/02/liferay-servlet-filter-hooks.html

我的 doFilter 方法中的注销代码(在servlet过滤器中):

My code for logout in doFilter method (in servlet filter):

final HttpServletRequest httpServletRequest = (HttpServletRequest) request;
final HttpSession session = request.getSession(false);

if (session != null)
{
    session.invalidate();
}

filterChain.doFilter(request, response);

这篇关于Liferay-自动登录挂钩/Portlet不会注销当前用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆