<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: CAP JAVA: CDS service with $batch requires authentica... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/cap-java-cds-service-with-batch-requires-authentication/qaa-p/14314193#M4935753</link>
    <description>&lt;P&gt;I would recommend to split entities into two services (code duplications are fine in this case). Service in CAP is supposed to be for one purpose, in case if you need both authenticated and public access to one service, it clearly indicates you are using one service for more than one purpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 25 Jan 2026 08:12:49 GMT</pubDate>
    <dc:creator>OlegsBugrovs</dc:creator>
    <dc:date>2026-01-25T08:12:49Z</dc:date>
    <item>
      <title>CAP JAVA: CDS service with $batch requires authentication</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-java-cds-service-with-batch-requires-authentication/qaq-p/13627909</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a CAP JAVA application where I defined a service with &lt;STRONG&gt;public&lt;/STRONG&gt; entities and &lt;STRONG&gt;protected&lt;/STRONG&gt; entities with &lt;STRONG&gt;requires&lt;/STRONG&gt;&amp;nbsp;annotation like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="christoffer_fuss_0-1709628385428.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/75413i94281515ABF5A3C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="christoffer_fuss_0-1709628385428.png" alt="christoffer_fuss_0-1709628385428.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I can consume all my public entities without authentication.&amp;nbsp;&lt;BR /&gt;But the &lt;STRONG&gt;$batch&lt;/STRONG&gt; request gives a &lt;STRONG&gt;401&lt;/STRONG&gt; error and requires authentication.&lt;BR /&gt;How can I make the $batch public as well with requires annotation?&lt;BR /&gt;I tried with spring security config:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="christoffer_fuss_1-1709628754589.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/75424iD53DF8D2FC62EAC5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="christoffer_fuss_1-1709628754589.png" alt="christoffer_fuss_1-1709628754589.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This makes the $batch public but then I cannot get the authentication info of logged in users, so&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;userInfo.isAuthenticated&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;()&lt;/STRONG&gt; is always false (also for logged in users).&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="christoffer_fuss_2-1709629147112.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/75428i98EF7B2D7C271217/image-size/medium?v=v2&amp;amp;px=400" role="button" title="christoffer_fuss_2-1709629147112.png" alt="christoffer_fuss_2-1709629147112.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What is the best way to solve this?&lt;BR /&gt;&lt;BR /&gt;Best regards and many thanks,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 09:04:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-java-cds-service-with-batch-requires-authentication/qaq-p/13627909</guid>
      <dc:creator>christoffer_fuss</dc:creator>
      <dc:date>2024-03-05T09:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: CAP JAVA: CDS service with $batch requires authentica...</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-java-cds-service-with-batch-requires-authentication/qaa-p/14314193#M4935753</link>
      <description>&lt;P&gt;I would recommend to split entities into two services (code duplications are fine in this case). Service in CAP is supposed to be for one purpose, in case if you need both authenticated and public access to one service, it clearly indicates you are using one service for more than one purpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jan 2026 08:12:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-java-cds-service-with-batch-requires-authentication/qaa-p/14314193#M4935753</guid>
      <dc:creator>OlegsBugrovs</dc:creator>
      <dc:date>2026-01-25T08:12:49Z</dc:date>
    </item>
  </channel>
</rss>

