on 2024 Mar 05 9:04 AM
Hello,
I have a CAP JAVA application where I defined a service with public entities and protected entities with requires annotation like this:
I can consume all my public entities without authentication.
But the $batch request gives a 401 error and requires authentication.
How can I make the $batch public as well with requires annotation?
I tried with spring security config:
This makes the $batch public but then I cannot get the authentication info of logged in users, so
What is the best way to solve this?
Best regards and many thanks,
Chris
Request clarification before answering.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.