legacy-knowledge-base
Publicado Jul. 25, 0002

Guest users are able to access an endpoint if PortalSessionAuthVerifier is enabled

written-by

Jose L. Bango

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

  • We have followed this How-To article: How to add security, authentication to my REST service? (Section 5.1), but guest users are still able to access our endpoint from a browser.
  • If we enable PortalSessionAuthVerifier, users without an active session are able to access the endpoint.

Environment

  • Liferay DXP 7.0

Resolution

  • Due to the AuthVerifiers layer design in DXP 7.0, an extra step would be needed to prevent guest users from accessing the endpoint.
  • Implement a user-permission layer inside your REST application to check if a user is signed-in by adding something like this:
    PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker();

    if (!permissionChecker.isSignedIn()) {
    throw new WebApplicationException(Response.Status.FORBIDDEN);
    }

Additional Information

did-this-article-resolve-your-issue

legacy-knowledge-base