legacy-knowledge-base
公開されました Jun. 30, 2025

The Impersonation Attempt Fails Without Errors in the Logs or UI

written-by

Emma Carr-Gardner

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

Issue

  • Admin users are unable to impersonate other users.
  • When attempting to impersonate, a new tab opens, but it remains on the original user.
  • Impersonation attempts fail, the `doAsUserId?` is missing from the URL.

Environment

  • Liferay DXP 7.4 +

Resolution

  •  Start the bundle and navigate to Control Panel > Instance Settings >> Instance Configuration >> General, you'll notice two fields:
    • Home URL
    • Default Logout Page
  • These URLs can use a servlet that is mapped to a Friendly URL Servlet like `/web/*`

  • These URLs should not be mapped to need to a servlet mapped to a Main Servlet, as defined in shielded-container-web.xml

    <servlet-mapping> <servlet-name>Main Servlet</servlet-name> <url-pattern>/c/*</url-pattern> </servlet-mapping>
  • This is the same for the portal-ext.property `portal.impersonation.default.url=`

    Using /c/*, the impersonation request will not be completed. A new tab opens, but remains on the “users and user group” page as the original account.  See the following tests:

     

    ❌ Scenario 1:
    portal.impersonation.default.url= /c/portal/login
    Home URL = /c/portal/login

    ❌ Scenario 2:
    portal.impersonation.default.url= /c/portal/login
    Home URL = empty

    ❌ Scenario 3 (client’s setup, verified)
    portal.impersonation.default.url=/web/guest
    Home URL = /c/portal/login

    ✅ Scenario 4:
    portal.impersonation.default.url=/web/guest
    Home URL =/web/guest

    ✅ Scenario 5:
    portal.impersonation.default.url=/web/guest
    Home URL = empty
  • After removing /c/portal/login from the “Home URL” and “Default Logout Page”, the administrator should be able to impersonate other users. 
did-this-article-resolve-your-issue

legacy-knowledge-base