Skip to Content

Configure Authentication and Authorization on SAP BTP

Set up authentication and authorization on SAP BTP and deploy your secured application there.
You will learn
  • How to test authorizations on the applications deployed to SAP BTP, Cloud Foundry
renejeglinskyRené JeglinskyDecember 8, 2023
Created by
iwonahahn
July 14, 2022
Contributors
vmikhailenko
renejeglinsky
iwonahahn

Before you deploy your authentication-enabled application you have to create an instance of service Authorization and Trust Management Service (XSUAA) and configure it, bind it to your application and provide it with the security descriptor that contains roles and scopes of your application. For more details, see section Protecting Your Application in the SAP BTP documentation.

  • Step 1

    Open your application in the browser. Using the links on the welcome page you can check that you can’t access the Orders entity or everything under the AdminService. You should see a 401 error in case you click on these.

    To use the AdminService, you need to assign yourself to the role collection BookStore_Administrators that was defined in the xs-security.json file. To assign this role collection to your user you need to navigate to the Security Role Collections section of your SAP BTP subaccount.

    1. Select the BookStore_Administrators role collection and choose Edit. Enter your email address in the ID and E-Mail field and choose Save.
      role assignment to administrator
  • Step 2
    1. To take effect of the change to the role collection, you need to restart the approuter:

      Shell/Bash
      Copy
      cf restart bookstore
      
    2. Open the application in the browser. The according route can be found under routes of the previous step.

    3. Observe that your application is now secured by an authentication flow (very quick) and that you can access the AdminService because you’ve assigned the respective role to you.

    Done! You have learned how to deploy secured applications to SAP BTP, Cloud Foundry and assign the needed roles.


Back to top