{"ref":"content:securing-sap-cap-applications-xsuaa-roles-and-authorization-best-practices","page":"/content/securing-sap-cap-applications-xsuaa-roles-and-authorization-best-practices","json":"/content/securing-sap-cap-applications-xsuaa-roles-and-authorization-best-practices.json","generated":"2026-11-15","drafted_with_ai":true,"entity":{"id":"securing-sap-cap-applications-xsuaa-roles-and-authorization-best-practices","title":"Securing SAP CAP Applications: XSUAA, Roles, and Authorization Best Practices","url":"https://community.sap.com/t5/technology-blog-posts-by-sap/securing-sap-cap-applications-xsuaa-roles-and-authorization-best-practices/ba-p/14151614","content_type":"blog","published_on":"source:sap-community","explains":[{"ref":"capability:authorization","applies_to":{"ecosystems":["cap"]}}],"summary":"Walks through securing a CAP service end to end: declaring scopes and role templates in xs-security.json for the [SAP Authorization and Trust Management service](artifact:btp-authorization-and-trust-management) (XSUAA), restricting CDS service definitions with `@restrict` per role, and dropping into handler code where a rule needs custom logic, with a [@sap/cds](artifact:sap-cds) [Node.js](external:nodejs) example that tests roles through `req.user.is` and a Java one that tests scopes through `hasScope`. It closes in the BTP cockpit, where a role collection is assigned to users so that their JWT carries the scopes those checks read.","short":"Securing a CAP service with XSUAA scopes, roles and @restrict","author":"Soumya-Pirlamarla","published":"2025-07-14","provenance":{"discovered_via":[{"source":"source:sap-community","channel":"btp-security-tag"}],"first_seen":"2026-10-07"},"drafted_with_ai":true},"readings":{"liveness":[{"label":"Checked against the source","tier":"unknown","evidence":"nobody has checked it"},{"label":"Source reachable","tier":"unknown","evidence":"not crawled"},{"label":"Age","tier":"fair","evidence":"published 16 months ago"}],"compatibility":[{"label":"Version","tier":"unknown","evidence":"no version declared"},{"label":"Moved since?","tier":"good","evidence":"no recorded change after 2025-07-14"},{"label":"Findings","tier":"good","evidence":"none flagged"}],"reach":[{"value":7168,"unit":"views"},{"value":1,"unit":"comments"},{"value":2,"unit":"likes"}]},"signals":{"views":7168,"likes":2,"comments":1,"metrics_at":"2026-11-01"},"series":null,"edges":{"authors":[]}}