SampleSampletypeA worked example you read or clone. Evidence: it demonstrates, it never provides.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →Reference

btp-user-management-microservice

A CAP microservice, backed by the XSUAA APIs, that manages business applications' users and their authorizations on SAP BTP, with a Fiori Elements UI for testing the role assignments.

Business applications on SAP Business Technology Platform each need a way to manage which users hold which authorizations, and this microservice shows how to build that using the Authorization and Trust Management Service (XSUAA) APIs from Cloud Foundry. It is built with the CAP Node.js framework and exposes a simple SAP Fiori Elements UI for testing the resulting role assignments, rather than a production-ready administration tool. The README targets experienced CAP developers and says the code is provided as is, serving exclusively as a reference for further development.

Facts

Last pushLicenceApache-2.0

Where it sits

Lives in
Demonstrates
AuthorizationCAPAuthorizationcapabilityDeciding who may read or change what, at service, entity and instance level — role checks, forwarded user context, and restrictions evaluated as query filters rather than after the fact.
Requires
SAP Authorization and Trust Management serviceSAP Authorization and Trust Management serviceartifactthe APIs the microservice calls to manage users and their authorizations.

Who is behind it

SAP SamplesSAP SamplesOrganisationMaintains this
In the atlas: maintains 222
@SAP-samples
maintainerAjinkya PatilPersonContributes to this
In the atlas: contributes to 112
@ajinkyapatil8190
Alessandro BiagiPersonContributes to this
In the atlas: contributes to 4, wrote 2
@ale-biagi
2 contributors

What it declares

Every artifact

Type
Sample
Origin
By SAP
Use as
A reference

As a sample

Form
A reference application

Connections2

ArchitectureBetaRead from the sample's deployment descriptor. Some of the connections it states are not drawn yet.

as mta.yaml states it at 83558c7, read
SAP BTP, Cloud Foundry Runtimeuser-mngrmta.yaml, module user-mngr-srv, requires uaa_user-mngrbinding, HTTP, outboundSAP Authorization and Trust Management service, xsuaa, applicationSAP Authorizationand TrustManagement serviceuser-mngr-srv, nodejsuser-mngr-srvuser-mngr-destination-content, com.sap.application.contentuser-mngr-destinatio…user-mngr-app-content, com.sap.application.contentuser-mngr-app-contentusermngr, html5usermngrSAP HTML5 Application Repository service for SAP BTP, html5-apps-repo, app-hostSAP HTML5ApplicationRepository servicefor SAP BTPSAP Destination service, destination, liteSAP Destinationservice
SAPnot SAP's, or the project's ownauthenticationstated in the document

Bound, and not drawn

Documented, with no instance in the document

README

quoted from SAP-samples/btp-user-management-microservice under Apache-2.0, read
SAP-samples/btp-user-management-microservice/README.mdOn GitHub

SAP BTP User Management Microservice

License: Apache2 REUSE status

Description

This sample code aims to help SAP developers (customers or partners) to develop secure applications on SAP Business Technology Platform using the Authorization and Trust Management Service (XSUAA) APIs from Cloud Foundry. The code is developed using the SAP Cloud Application Programming Model (CAP) NodeJS framework and implements a microservice to manage business applications' users and their respective authorizations with a simple SAP Fiori Elements UI for testing.

IMPORTANT NOTE: please be aware that the code in this repository is targeted to experienced CAP developers and is provided as is, serving exclusively as a reference for further developments

Solution Architecture

BTP User Management Microservice Architecture

Requirements

  • SAP Business Technology Platform subaccount (productive or trial) with Cloud Foundry environment enabled
  • SAP Business Application Studio entitlement / subscription (Full Stack Cloud Application Dev Space)
  • SAP Workzone Standard (formerly SAP Launchpad Service) entitlement / subscription

Download and Installation

Clone the Project Repo
  1. Access your SAP Business Application Studio full-stack cloud development Dev Space
  2. Open a new terminal (if not yet opened): Terminal > New Terminal
  3. From the default projects folder, create the project directory:

NOTE: if you have not set the projects folder to become your current workspace in BAS your terminal might end-up in the user folder. So, do cd projects before executing the command below.

mkdir user-mngr
  1. Clone this repo into the recently created directory:
git clone https://github.com/SAP-samples/btp-user-management-microservice.git user-mngr
Create the Required Service Instances
  1. Login to Cloud Foundry:
cd user-mngr && cf login
  1. Create the Destination service:
cf create-service destination lite dest-svc
  1. Create the XSUAA service (application plan):
cf create-service xsuaa application xsuaa-svc -c xs-security.json
  1. Create the XSUAA service (apiaccess plan):
cf create-service xsuaa apiaccess xsuaa-api
  1. Create the XSUAA service (apiaccess plan) service key:
cf create-service-key xsuaa-api xsuaa-api-sk
Bind Destination and XSUAA (application) Services to the CAP Project
  1. Temporarily rename the .env file to default.env:
mv .env default.env
  1. On the left-hand pane of BAS click on the Cloud Foundry icon (small lightbulb)
  2. Expand the Services node
  3. Right-click the dest-svc (destination) item
  4. Select Bind a service to a locally run application
  5. From the directories list select the user-mngr directory and click OK
  6. Repeat steps 4 to 6 for the xsuaa-svc (xsuaa) item
  7. Go back to the Explorer, open the recently created .env file and adjust its contents to become a JSON object like demonstrated below:

VCAP_SERVICES JSON object

  1. Rename the .env file to default-env.json:
mv .env default-env.json

HINT: you can open the recently renamed file (default-env.json) and format the JSON content with ALT+Shift+F for better visualization.

  1. Rename the default.env file back to .env
mv default.env .env
Install Project Dependencies
  1. Setup npm registry:
npm config set registry https://registry.npmjs.org/

NOTE: this is important to avoid issues when running npm clean-install in the MTA build process.

  1. Install service dependencies:
npm install
  1. Install UI dependencies:
cd app/user-mngr && npm install && cd ../..
Create the Destination to the XSUAA API
  1. Display the XSUAA (apiaaccess plan) service key:
cf service-key xsuaa-api xsuaa-api-sk
  1. Take note (copy) the following service key properties:
  • apiurl
  • clientid
  • clientsecret
  • url
  1. Open the BTP cockpit and access your subaccount (same subaccount used to start the BAS Dev Space)
  2. On the left-hand pane expand the Connectivity node
  3. Click on Destinations
  4. Click on New Destination
  5. Fill-in the required information like demonstrated below:

XSUAA API destination

  1. Click Save
Assign the Application's Role Collections to Your User
  1. Open the BTP cockpit and access your subaccount (same subaccount used to start the BAS Dev Space)
  2. On the left-hand pane expand the Security node and click on Users
  3. In the users list on the right, click on your user

HINT: if the users list is to long and you find it difficult to locate your user, you can use the search box at the top.

  1. In the user's details at the right, click on Assign Role Collection
  2. Find the role collections starting with GenericApp
  3. Check both role collections
  4. Click on Assign Role Collection
Test Application Locally
  1. Start the application in BAS:
cds watch
  1. CTRL+Click the http://localhost:4004 link in the terminal to open the service home page in a new tab

NOTE: you must allow pop-ups for your BAS URL in your browser in order to get the new tab to be properly opened.

  1. Click on the User link
  2. When prompted to Sign in type john as the Username and click Sign in
  3. You should see the information from your user in JSON format like demonstrated below:

User information

  1. Click on the other two links (IdP and Authorization) to check whether they are working fine as well
  2. In the Terminal press CTRL+C to terminate the service
Deploy Application to Cloud Foundry
  1. From the Explorer open the mta.yaml file
  2. Search for the [your BTP subdomain] string and replace it with the subdomain of your BTP subaccont

HINT: you can find the subdomain name in the Overview page of your subaccount in the BTP cockpit

  1. From the Explorer open the app/user-mngr/webapp/manifest.json file and do the same search & replace procedure as in the previous step
  2. In the Explorer right-click on the mta.yaml file and select Build MTA Project
  3. When the build process finishes, an mta_archives directory will appear in the Explorer
  4. Expand the mta_archives directory
  5. Right-click the user-mngr_1.0.0.mtar and select Deploy MTA Archive
Test the Application in Cloud Foundry
  1. On the left-hand pane of your BTP cockpit, click on HTML5 applications

NOTE: the applications will be listed only if you have at least SAP Workzone Standard (formerly SAP Launchpad Service) enabled in your subaccount (please, see the Requirements section).

  1. Click on the usermngr link
  2. The Fiori Elements UI of the service will open in a new tab
  3. You can use this UI to fully test the microservice: create, update and/or delete users of your application (users who have the GenericApp role collections assigned)

FINAL NOTE: having the application deployed to the HTML5 apps repository you can optionally add it to a SAP Workzone Standard site.

Code Details

You can find a detailed explanaton about the code of this project in this blog post.

Known Issues

No known issues.

How to obtain support

Create an issue in this repository if you find a bug or have questions about the content.

For additional support, ask a question in SAP Community.

Contributing

If you wish to contribute code, offer fixes or improvements, please send a pull request. Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses the standard DCO text of the Linux Foundation.

License

Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

Apache-2.0, read

Details

Sources3
Added by handdiscovered herechecked
github.com/SAP-samples/btp-user-management-microservicetree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viaAdded by hand
first seen in the atlas
ecosystem and domaincap, security-and-compliance
Contributors2

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:sap-samples-btp-user-management-microservice
JSON
/artifacts/sap-samples-btp-user-management-microservice.json
MCP
Connecting an agent