Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3605868
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:10:38+00:00 2026-05-18T21:10:38+00:00

Apparantely liferay does not log the currently logged in user if you try to

  • 0

Apparantely liferay does not log the currently logged in user if you try to login again, and in fact even keeps the currently logged in user logged in.
So I’m trying to force a logout.

I tried:

request.getSession().invalidate();

But that does not seem to work besides somehow breaking the login functionality.

I was wondering if anyone has any other idea how to force a logout.

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 on cookiekeys/processorserviceutil/… depending on which I replace with a more base level. (like processorserviceutil with a processorserviceimpl and copy the function code from proeccesorserviceutil).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:10:39+00:00Added an answer on May 18, 2026 at 9:10 pm

    1) session.invalidate() only works if authentication is managed by the application server session, which it is not 😉

    2) regardless of whether you use Community or Enterprise edition, you should have enough source code to achieve whatever you want

    3) portal-ext.properties supports login chains as well as pre- and post-login hooks

    4) Logout calls com.liferay.portal.action.LogoutAction which contains a bunch of logic but without spoiling the ending it should give you enough to shake the other Liferay authentication parts lose.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to insert a date when a user decides to deactivate or activate
Apparently, Microsoft has not yet made WebGL work in Internet Explorer by default. Plus,
Apparently you can easily obtain a client IP address in WCF 3.5 but not
UPDATE : This question is not homework. And not waterproof apparantly... I wanted a
Does anyone know of a clean and easy way to truncate a section of
I try to measure the clock cyles needed to execute a piece of code
I am trying to get an existing application to show up as a portlet
We are trying to setup a simple BTB site to support our retailers (somewhere
Im quite new to silverlight and windows 7 phone development. And I'm not sure
I am trying to execute a stored procedure, but the following line is giving

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.