Restrict guest users from accessing login page when attempting to access a protected page or resource
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
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- By default, guest users are prompted to the login page when they are attempting to hit a url or access a resource that is protected and not available to guest users. I do not want guest users to be redirected to the login page.
Environment
- Liferay Portal
- Liferay DXP
Resolution
- Leverage the following portal properties to alter the default behavior of redirecting guest users to the login page when attempting to access a protected resource:
# Enter a URL that will be used to login portal users whenever needed.
# By default, the portal's login page is used.
#
# Env: LIFERAY_AUTH_PERIOD_LOGIN_PERIOD_URL
#
#auth.login.url=/web/guest/home
#
# Set this to true to prompt a guest user to login when attempting
# to access a protected page resource in the portal. By setting this
# value to false, the portal will inform all users that a requested
# resource is not found if they have no entitlements to view the
# resource. The portal will not prompt for login even if the user
# is a guest user. This behavior complies with OWASP best practices.
#
# Env: LIFERAY_AUTH_PERIOD_LOGIN_PERIOD_PROMPT_PERIOD_ENABLED
#
auth.login.prompt.enabled=true
#
# Enter a friendly URL of a page that will be used to login portal users
# whenever the user is navigating a site and authentication is needed.
# By default, the portal's login page or the URL set in the property
# "auth.login.url" is used.
#
# Env: LIFERAY_AUTH_PERIOD_LOGIN_PERIOD_SITE_PERIOD_URL
#
auth.login.site.url=/login
Did this article resolve your issue ?