<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Applying Service Access Policy to Custom rest Service - Liferay DXP 7.3</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121404075" />
  <subtitle>Applying Service Access Policy to Custom rest Service - Liferay DXP 7.3</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121404075</id>
  <updated>2026-04-05T03:24:17Z</updated>
  <dc:date>2026-04-05T03:24:17Z</dc:date>
  <entry>
    <title>RE: Applying Service Access Policy to Custom rest Service - Liferay DXP 7.3</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121409734" />
    <author>
      <name>Stian Sigvartsen</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121409734</id>
    <updated>2022-04-26T16:42:59Z</updated>
    <published>2022-04-26T15:53:06Z</published>
    <summary type="html">&lt;p&gt;REST webservices require a SAP entry that allows access to the JAX-RS
  resource &lt;strong&gt;implementation&lt;/strong&gt; class (and methods). If you
  leave the SAP entry as default=false, then it will only apply to
  authenticated users.&lt;/p&gt;
&lt;p&gt;A good way to find out exactly which class (and method) to add tot he
  SAP entry is to set the following portal property:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;access.control.sanitize.security.exception=false&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Then just make a request to the service and it will reveal it. p.s.
  We do not recommend setting this for production environments, hence it
  is &amp;quot;true&amp;quot; by default.&lt;/p&gt;
&lt;p&gt;If you would like finer access control then portal can dynamically
  apply such SAP entries based on granted OAuth 2 scopes. For that you
  need to give the SAP entry's name a prefix of &amp;quot;OAUTH2_&amp;quot;.
  Such SAP entries will appear on the &amp;quot;Scopes&amp;quot; tab when adding
  OAuth 2 applications. Meaning that in order for a service equest to be
  successful, it has to come with an access token which is granted that scope.&lt;/p&gt;
&lt;p&gt;I hope that answers your questions, but please let me know if not.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Stian&lt;/p&gt;
&lt;pre&gt;

 &lt;/pre&gt;</summary>
    <dc:creator>Stian Sigvartsen</dc:creator>
    <dc:date>2022-04-26T15:53:06Z</dc:date>
  </entry>
  <entry>
    <title>Applying Service Access Policy to Custom rest Service - Liferay DXP 7.3</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121404074" />
    <author>
      <name>mahesh gade</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121404074</id>
    <updated>2022-04-23T04:13:30Z</updated>
    <published>2022-04-21T14:35:38Z</published>
    <summary type="html">&lt;p&gt;Hi ,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I have created Liferay Custom Rest webservice and SAP(Service Access
  policy) but how can i apply this particular SAP to the Custom rest
  webservice to chack the Resource access?&lt;/p&gt;
&lt;p&gt;Can it be used for only unauthenticated services to expose particular methods?&lt;/p&gt;
&lt;p&gt;If SAP can be used for authenticated rest services how can we apply
  this SAP to services?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Mahesh.&lt;/p&gt;</summary>
    <dc:creator>mahesh gade</dc:creator>
    <dc:date>2022-04-21T14:35:38Z</dc:date>
  </entry>
</feed>
