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

Secure a CAP Application with SAP Cloud Identity Services

Secure the CAP bookshop application with the SAP Cloud Identity Services.

Overview

🎓 intermediate 60 min. TutorialIntermediateSAP Business Technology Platform

You will learn

  • โœ”How to use CAP in SAP Build Code.
  • โœ”How to jumpstart a new project.
  • โœ”How to deploy a CAP application secured by SAP Cloud Identity Services.
Prasita Sankar P Prasita Sankar July 23, 2025
Created by July 1, 2025
Contributors

Prerequisites

Prerequisites

  • You have a multi-environment subaccount on SAP BTP with Cloud Foundry enabled with a space.
    • Your user is a member of the Cloud Foundry org and space.
    • The Cloud Foundry Environment has at least 2 units assigned to the MEMORY plan. See Configure Entitlements and Quotas for Subaccounts.
    • You have a tenant of SAP Cloud Identity Services, either as a trial tenant or a productive tenant. See Initial Setup. You can’t use SAP ID Service for this scenario because you must be able to access the admin UI of SAP Cloud Identity Services to assign authorizations.
    • You have established trust between the multi-environment subaccount on SAP BTP and the tenant of SAP Cloud Identity Services. See Establish Trust.
  • You have Set Up SAP Build Code in SAP BTP. Follow the instructions to set up your system to start creating business applications in SAP Build Code.
  • You have an SAP HANA Cloud database running in your subaccount and you have the SAP HANA Cloud Administrator role collection.
    • SAP HANA Cloud with hana or hana-free plans and the tools plan.
    • SAP HANA Schemas & HDI Containers with the hdi-shared plan.
    • Your user has the SAP HANA Cloud Administrator role collection.
  • The platform user to set up these services in your subaccount and to be a member of the Cloud Foundry org and space.
  • The business (application) user, who has to be in the SAP Cloud Identity Services tenant, so that we can assign the authorizations for the test at the end.
  • The SAP Cloud Identity Services admin who assigns the authorizations. This person could also be the platform user for BTP.

Steps

Intro

The goal of this tutorial is to secure and deploy the CAP bookshop application, so only authenticated users with the required authorizations are able to see the book details within the application. Users without the necessary authorizations are able to log on to the application, but can see only the list of books.

Learn more about CAP in the capire one-stop documentation.

In this tutorial, the bookshop application starts with the Authorization and Trust Management service to provide authentication. However, we want to use SAP Cloud Identity Services instead, with Identity Authentication for logging on and Authorization Management for permissions to access the application. Therefore, we change the authentication to Identity Authentication.

We then later add the Data Control Language (DCL) files for Authorization Management. These files define an authorization policy.

Then, we deploy the bookshop application and try to access it with a business user. To see the admin part of the bookshop application, we assign the business user the admin authorization policy.

For more information about SAP Cloud Identity Services and CAP, see CDS-based Authorization.

User and Account Setup in BTP
User and Account Setup in BTP

User and Account Setup in BTP

Understanding the BTP User and Account Setup

There are at least three personas in setting up this tutorial.

PersonaIdentity ProviderDescription
Platform UserPlatformThe platform user is the administrator of the BTP subaccount and possibly for the BTP global account. To set up this scenario you’ll need a global account admin to assign quotas and entitlements to the subaccount. In addition to managing the platform, platform users also typically work as developers.
Business UserApplicationThe business user consumes the applications subscribed to or deployed in the subaccount. In this tutorial, business users can use SAP Business Application Studio to create the development project, but you need the platform user to deploy that development project in the command line interface (CLI). The business user then accesses the bookshop application that the platform user deployed.
IDP AdminAdmin of the identity providerIn this scenario, the identity provider administrator manages the users in the tenant of SAP Cloud Identity Services. SAP BTP and its applications use these identity providers to authenticate the platform and business users respectively. We need the IDP admin in this tutorial to assign the authorization policy to the business user so they can see the products in the CAP bookshop application.

Note: You can use the same identity provider for both the platform and business users. Then both users are in the same identity provider and are only distinguished by the authorizations you assign them.

Step 1 Create a new project using SAP Build
โ€”

This step includes creating an application in SAP Build Lobby.

  1. In the SAP Build Lobby, click Create > Create to start the creation process.

    Create a project
    Create a project

  2. Click the Application tile.

    Application tile
    Application tile

  3. Select the Full-Stack category.

    Full-Stack tile
    Full-Stack tile

  4. Select Full-Stack Node.JS to develop your full-stack application, based on the SAP Cloud Application Programming Model (CAP), in SAP Business Application Studio.

    Full-Stack Node.JS
    Full-Stack Node.JS

  5. Enter the project name, add a description (optional), select the dev space where you want the project to reside, and then click Review.

    Project details
    Project details

  6. Review the inputs under the Summary tab. If everything looks correct, click Create to proceed with creating your project.

  7. Your project is created in the Project table of the lobby. The creation of the project may take a few moments. After the project has been created successfully, click the project to open it.

    Bookshop project
    Bookshop project

  8. The project opens in SAP Business Application Studio.

    Project in SAP Build
    Project in SAP Build

Step 2 Start your project in SAP Business Application Studio
+
Step 3 Add the SCI configuration to your project
+
Step 4 Prepare for deployment
+
Step 5 Update the package.json file
+
Step 6 Deploy the application
+
Step 7 Test the application
+
Step 8 Assign the required authorization policy in SAP Cloud Identity Services
+
Step 9 Test the application again
+

Resources

Discussion

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

Submit detailed feedback Discuss in Community
Steps
Step 1 of 9
1. Create a new project using SAP Build 2. Start your project in SAP Business Application Studio 3. Add the SCI configuration to your project 4. Prepare for deployment 5. Update the package.json file 6. Deploy the application 7. Test the application 8. Assign the required authorization policy in SAP Cloud Identity Services 9. Test the application again

Learn more →