Secure a CAP Application with SAP Cloud Identity Services
- 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.
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.
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
Understanding the BTP User and Account Setup
There are at least three personas in setting up this tutorial.
| Persona | Identity Provider | Description |
|---|---|---|
| Platform User | Platform | The 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 User | Application | The 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 Admin | Admin of the identity provider | In 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.





















