With SAP BTP, software developers can build and deploy custom business applications and extensions. Software developers, together with architects and security experts, must ensure that a security concept for these custom applications is in place.
Caution
The concepts of this lesson are just applicable to applications deployed in Cloud Foundry or Kyma environment.
Customer-owned applications on SAP BTP should not be exposed to the internet because of security reasons. To prevent direct calls to the application, developers should use two additional components: the App Router and the SAP Authorization and Trust Management service (XSUAA).
Note
Developers can manually implement the entire authentication and authorization in the application coding itself. However, this approach is not recommended.
An App Router works as a central entry point to the application. It gets the requests from the web and acts as a client that forwards the request to the application. In parallel, it enables secure authentication. Technically, the App Router is a Node.js application where developers need to define the routes to which business application the user requests must be forwarded to. The information is stored in a JSON file (xs-app.json). The App Router is used in combination with the SAP Authorization and Trust Management service – XSUAA service – to authenticate a user and route the user to the business application with corresponding authorizations.
XSUAA is a service that helps to implement authentication and authorization. If you want to use the XSUAA service, you have to create an instance and bind it to your application. For each application, a single XSUAA instance can be used, or one XSUAA instance can be shared by multiple applications.
XSUAA service is not able to authenticate users because it does not store user data. So, a trust connection must be established with an identity provider.
Note
A trust connection to the default identity provider – SAP ID service – is established by default.
The XSUAA service is represented by an application security-descriptor JSON file (xs-security.json). The file defines properties of the XSUAA service instance to enable the authentication of the user when accessing an application. If user authorizations should be implemented, roles must be specified. The information in the file is used at application-deployment time to perform authentication and authorization checks.
Note
The explanationbefore this is valid for custom applications that are accessed by business users in the Cloud Foundry and Kyma environments. For these applications, a respective instance of the XSUAA service must be created, and the applications must be bound to it.
Find more information on the application-security descriptor JSON file here: Application Security Descriptor Configuration Syntax.
For secure access to the application using the App Router in combination with the XSUAA service, the authentication sequence is then the following:
- When the user access the business application, the request is sent to the App Router.
- The App Router acts as an OAuth client and forwards the access request to the XSUAA service.
- Since the XSUAA service does not store user data, it forwards the request to the identity provider to enforce the authentication of the user. If the identity exists in the user store of the identity provider, the authentication of the user is successful.
- The authentication against XSUAA is successful and the service generates an access token, called JSON Web Token (JWT), and passes it back to App Router.
- As the JWT token is needed to authenticate the user at the business application, the JWT token get forwarded to it.
To implement an authorization concept, developers need to maintain the application security-descriptor JSON file (xs-security.json), where they define different security options for an application by specifying the roles. The application security-descriptor file contains details of the authorization scopes, which are used for application access, and references any attributes that need to be applied. The developer can also provide application-based role templates there. The developers must have registered the role templates as OAuth 2.0 client in the User Account and Authentication (UUA) service, during application deployment.
Scopes
Attributes
Role Template
Predefined Role Collections
Role templates appear in SAP BTP cockpit under Security → Roles. Administrators create application-based Roles derived from role templates. For each attribute that the developer referenced in a role template, administrators can specify the value that restricts data access.
There are multiple sources of attributes:
Example