SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

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

🎓 beginner 20 min. SAP Cloud Application Programming ModelBeginnerSAP Business Technology PlatformJavaSAP Business Application Studio

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 December 10, 2024
Created by December 10, 2024
Contributors

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

Learn more →