In SAP BTP, you can use Java EE roles to define access to the application resources.
SAP Business Technology Platform, Neo environment will sunset on December 31, 2028, subject to terms of customer or partner contracts.
For more information, see SAP Note 3351844.
This documentation refers to SAP Business Technology Platform, Neo environment. If you are looking for documentation about other environments, see SAP Business Technology Platform
↗️ .
Terms
Term |
Description |
---|---|
Role |
Roles allow you to diversify user access to application resources (role-based authorizations).
|
Predefined roles |
Predefined roles are ones defined in the web.xmlof an application. See Authentication. After you deploy the application to SAP BTP, the role becomes visible in the Cockpit, and you can assign groups or individual users to that role. If you undeploy your application, these roles are removed. Predefined roles can be:
|
Custom roles |
Custom roles are ones defined using the Cockpit. Custom roles are interpreted in the same way as predefined roles at SAP BTP: they differ only in the way they are created, and in their scope. You can add custom roles to an application to configure additional access permissions to it without modifying the application's source code. Custom roles are visible and accessible only within the subaccount where they are created. That’s why different accounts subscribed to the same application could have different custom roles. |
User |
Users are principals managed by identity providers (SAP ID service or others).
|
Group |
Groups are collections of roles that allow the definition of business-level functions within your subaccount. They are similar to the actual business roles existing in an organization, such as "manager", "employee", "external" and so on. They help you to get better alignment between technical Java EE roles and organizational roles.
For each identity provider (IdP) for your subaccount, you define a set of rules specifying the groups a user for this IdP belongs to. |
This can be done in two ways: using predefined roles in the web.xml at development time, or using custom roles in the UI.
If you need to do mass role or group assignment, to a very large number of users simultaneously, we recommend using the Authorization Management API instead of the cockpit UI. See Using Platform APIs.
-
Predefined Roles
-
In the web.xml of the required application, define the roles authorized to access the application resources.
See Authentication.
-
Deploy the application to SAP BTP.
-
Optionally, if you want to restrict the roles to the current application only, deselect the Share option for them in the Cockpit.
-
-
Custom roles with applications from the same subaccount
-
In the cockpit, go to the Applications > Java Applications section.
-
Click the required application link.
-
Enter the Roles section.
-
Choose Create.
-
Type the role name and choose Create.
-
-
Custom roles with applications subscribed from other accounts
-
In the cockpit, go to the Applications > Subscriptions section.
-
In the list of subscribed aplications, click the required application link.
-
Enter the Roles section.
-
Choose Create.
-
Type the role name and choose Create.
-
Groups allow you to easily manage the role assignments to collections of users instead of individual users.
-
In the cockpit, go to the Security > Authorizations section for the subaccount.
-
Enter the Groups tab.
-
Choose Create.
-
Enter the group name and choose Create.
You can assign individual users to the roles or, more conveniently, assign groups for collective role management.
You can do it in either of the two ways: using the Security > Roles section for the application, or using the Security > Authorizations section for the subaccount.
-
Using the Roles section
-
In the cockpit, go to the Applications > Java Applications section.
-
Click the required application link.
-
Enter the Security > Roles section.
-
Select the role you want to manage assignments for.
-
To assign a new user or group, choose Assign for the Users or Groups section respectively.
-
Enter the user or group name.
-
Choose Assign, and specify the required user or group name.
-
-
Alternatively, you can do it using the Authorizations section for the subaccount.
-
In the cockpit, go to the Security > Authorizations section for the subaccount.
-
Enter the Users or Groups tab respectively.
-
For the Users tab, enter the name of the required user and choose Show Assignments. For the Groups tab, choose the required group from the list, or create a new one and choose it.
The Roles table below shows all roles that are already assigned to this user or group.
-
In the Roles table, choose Assign, and specify the required role.
-
- Your subaccount has a Custom trust configuration with at least one fully configured application identity provider. See Application Identity Provider and Identity Authentication Tenant as an Application Identity Provider.
- You have defined the groups and their role assignments in the Security > Authorizations section of the cockpit. See Step 2 and Step 3.
For each different identity provider (IdP), you can define a set of rules specifying automatic group assignments for the users logged by this IdP. If you have already assigned those groups to roles, this will result in the IdP users automatically getting the required roles.
-
Go to the Security > Trust > Application Identity Provider section in the cockpit.
-
Select the required application identity provider from the list.
-
In the identity provider settings, go to the Groups section.
There are two IdP group types: default groups and assertion-based groups.
IdP Group Type
Description
Example
Default group
All users logged by this IdP will have this group assignment.
All users logged by the company IdP can be assigned to the group Internal. You may decide to give this group the role Access Internal Corporate Portal.
Assertion-based group
Determined by values of attributes in the SAML 2.0 assertion.Only the IdP users that have the required values will be assigned to it.
The users with SAML 2.0 assertion containing the attribute
contract=temporary
will be assigned to the group TEMPORARY. The users with SAML 2.0 assertion containing the attributecontract=permanent
will be assigned to the group PERMANENT. The two groups will have different role assignments. -
Define the groups as required.
-
Default groups
Choose Add Default Group, and select the required group from the drop-down list.
If the list is empty or the group you need is missing, you can create it from the Security > Trust > Authorizations > Groups section in the cockpit. You can then assign the required roles for it in the same section.
-
Assertion-based groups
-
Choose Add Assertion-Based Group, and select the required group from the drop-down list..
If the list is empty or the group you need is missing, you can create it from the Security > Trust > Authorizations > Groups section in the cockpit. You can then assign the required roles for it in the same section.
-
Specify the mapping rules.
In the first field of the Mapping Rules section, enter the SAML 2.0 assertion attribute name to be used as the mapping source. In other words, the value of this attribute will be compared with the value you specify (in the last field of Mapping Rules).
-
Choose the comparison operator.
Equals
Choose Equals if you want the value of the SAML 2.0 assertion attribute to match exactly the string you specify. Note that if you want to use more sophisticated relations, such as "starts with" or "contains", you need to use the Regular expression option.
Regular expression
Choose Regular expression if you want to specify more sophisticated matching rules. You can use all regular expression rules described in theJava RegEx API.
Example 1: You want to add authenticated SAP employees to group Employees. And SAP employees are users with e-mail address ending with sap.com. Hence, you choose the mapping rule to be email, matched using the following regular expression:
.*@sap.com$
Example 2: You want all users with name starting with admin to be added to group Administrators. Hence, you choose the mapping rule to be userid, matched using the following regular expression:
^(admin).*
-
In the last field of Mapping Rules, enter the value with which you compare the specified SAML 2.0 assertion attribute.
Adding a new rule binds it to the rest using a logical OR operator.
Adding a new subrule binds it to the rest of the subrules using a logical AND operator.
In the graphic below, all users logged by this IdP are added to the group Government. The users that have an arrtibute corresponding to their department name will also be assigned to the respective department groups.
When you open the Groups tab page of the Authorizations section, you can see the identity provider mappings for this group.
-
-
Try to access the required application logging on with users with and without the required roles respectively.
You may use the following steps to configure default role caching settings. This may be required if you have automated test procedures for role assignments in your applications. Tests may not work properly with the default subaccount settings.
The default role caching behavior is as follows:
If there are more than com.sap.security.um.ratelimiter.cache.maximum_requests_per_user
(default is 20
) stateless requests within com.sap.security.um.ratelimiter.cache.time_period
(default is 2 minutes
) with the same user to check the user permission, we cache hers roles for com.sap.security.um.ratelimiter.cache.validity
(default is 5 minutes
). This means that new assignments/unassignments will not work for 5 minutes.
You can take one of the following approaches:
- Increase the time in which the requests are counted to more than the default 2 minutes.
- Increase the number of requests – instead of the default 20, set 100 or 200, for example.
The table below shows the VM system properties available for configuring role caching:
VM Property |
Description |
Default Value |
---|---|---|
com.sap.security.um.ratelimiter.cache.maximum_user_entries |
The maximum user entries stored in the role cache. |
1000 |
com.sap.security.um.ratelimiter.cache.validity |
The cache validity in time. |
5 (in minutes) |
com.sap.security.um.ratelimiter.cache.time_period |
The time period for role caching. |
2 (in minutes) |
com.sap.security.um.ratelimiter.cache.maximum_requests_per_user |
The maximum requests per user stored in the role cache. |
20 |
Set the required values to the required VM system properties as described in Configure VM Arguments.