SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Add Authentication and Authorization to the Application

Add authentication and authorization to the application and test it locally with mock users

Overview

You will learn

  • How to add authentication and authorization to the application
  • How to test security aspects with the application running locally
René Jeglinsky R René Jeglinsky August 21, 2026
Created on December 10, 2024
Contributors

More from René Jeglinsky

See all 13 tutorials by René Jeglinsky →

Prerequisites

Steps

Step 1 Enable Authentication

In this tutorial you add authentication to your application by adding the cds-starter-cloudfoundry dependency, which enables CAP Java’s secure-by-default behavior based on Spring Security.

  1. Edit the pom.xml in the srv directory (not the pom.xml file located in the root project folder) and under the <dependencies> tag add the cds-starter-cloudfoundry dependency. Make sure you Save the file.

    XML
    <dependency>
        <groupId>com.sap.cds</groupId>
        <artifactId>cds-starter-cloudfoundry</artifactId>
    </dependency>
Step 2 Add authentication to the Orders service
+
Step 3 Add mock users to application configuration
+
Step 4 Add users with roles to the application
+
Step 5 Advanced authorizations on the entities
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Enable Authentication 2. Add authentication to the Orders service 3. Add mock users to application configuration 4. Add users with roles to the application 5. Advanced authorizations on the entities
Next