Liferay: how to get out of the auto catalog first

Obviously, a person does not register a registered user if you are trying to log in again, and in fact even holds a registered user at the moment. Therefore, I am trying to force logout.

I tried:

request.getSession().invalidate(); 

But this does not seem to work, somehow violating the input functionality.

I was wondering if anyone has any other idea on how to get the logout out.

Edit:

 try { HttpSession session = request.getSession(); EventsProcessorUtil.process(PropsKeys.LOGOUT_EVENTS_PRE, PropsUtil.getArray(PropsKeys.LOGOUT_EVENTS_PRE), request, response); String domain = CookieKeys.getDomain(request); Cookie companyIdCookie = new Cookie(CookieKeys.COMPANY_ID, StringPool.BLANK); if (Validator.isNotNull(domain)) { companyIdCookie.setDomain(domain); } companyIdCookie.setMaxAge(0); companyIdCookie.setPath(StringPool.SLASH); Cookie idCookie = new Cookie(CookieKeys.ID, StringPool.BLANK); if (Validator.isNotNull(domain)) { idCookie.setDomain(domain); } idCookie.setMaxAge(0); idCookie.setPath(StringPool.SLASH); Cookie passwordCookie = new Cookie(CookieKeys.PASSWORD, StringPool.BLANK); if (Validator.isNotNull(domain)) { passwordCookie.setDomain(domain); } passwordCookie.setMaxAge(0); passwordCookie.setPath(StringPool.SLASH); CookieKeys.addCookie(request, response, companyIdCookie); CookieKeys.addCookie(request, response, idCookie); CookieKeys.addCookie(request, response, passwordCookie); try { session.invalidate(); } catch (Exception e) { } EventsProcessorUtil.process(PropsKeys.LOGOUT_EVENTS_POST, PropsUtil.getArray(PropsKeys.LOGOUT_EVENTS_POST), request, response); } catch (Exception e) { try { PortalUtil.sendError(e, request, response); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (ServletException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } 

Gives noclassdeffounderrors to cookiekeys / processorerviceutil / ... depending on what I'm replacing at a more basic level. (e.g. moduleserviceutil with servicimpl handler and copy the function code from proeccesorserviceutil).

+4
source share
1 answer

1) session.invalidate () only works if authentication is controlled by an application server session that is not;)

2) regardless of whether you are using a Community or Enterprise version, you should have enough source code to achieve what you want

3) portal -ext.properties supports logical chains as well as hooks before and after login

4) Logging out of com.liferay.portal.action.LogoutAction, which contains a bunch of logic, but without ruining the ending, should give you enough to shake the rest of the Liferay authentication.

Hope this helps.

-1
source

Source: https://habr.com/ru/post/1332488/


All Articles