From 2fe6744cdf0fae990939d7cf1cf3ad505ca77617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Fri, 14 Mar 2025 11:20:45 +0100 Subject: [PATCH 1/6] Use cds add --- .../xsuaa-to-ams/2-integrate-with-ams.md | 28 ++++--------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/documentation/xsuaa-to-ams/2-integrate-with-ams.md b/documentation/xsuaa-to-ams/2-integrate-with-ams.md index 20d730f..6656352 100644 --- a/documentation/xsuaa-to-ams/2-integrate-with-ams.md +++ b/documentation/xsuaa-to-ams/2-integrate-with-ams.md @@ -3,30 +3,14 @@ ### Implement in Your Application - 1. Add the latest versions of `@sap/ams` dependency to `package.json/dependencies` - ```json - "@sap/ams": "^1.18.1", - ``` - 2. Add the latest versions of `@sap/ams-dev` dependency to `package.json/devDependencies` - ```json - "@sap/ams-dev": "^1.3", - ``` - 3. Make sure you have installed latest version of `@sap/xssec` dependency. - ```sh - npm install @sap/xssec - ``` - 4. Make sure you have `@sap/cds-dk` with `version > 8` is installed as a **global** npm module. + 1. Make sure you have `@sap/cds-dk` with `version > 8` is installed as a **global** npm module. > Use `npm update -g` instead of `npm update` to update the library. - 3. Add the following code to `package.json/cds/requires/[development]/auth`: - ```json - "ams" : { - "autoCompile" : true, - "cache" : { - "TTL" : 0 - } - } + 2. Add needed dependencies + ```sh + cds add ams ``` - 4. Build the project to install the added dependencies + > This adds the needed cofiguration for AMS as well as IAS. + 3. Install the added dependencies ```sh npm i ``` From a1e35a697926101173ee0cf507187d5dc23beb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Fri, 14 Mar 2025 11:36:49 +0100 Subject: [PATCH 2/6] Use cds add --- documentation/xsuaa-to-ams/3-deploy-to-cf.md | 193 +------------------ 1 file changed, 10 insertions(+), 183 deletions(-) diff --git a/documentation/xsuaa-to-ams/3-deploy-to-cf.md b/documentation/xsuaa-to-ams/3-deploy-to-cf.md index f397a46..159327e 100644 --- a/documentation/xsuaa-to-ams/3-deploy-to-cf.md +++ b/documentation/xsuaa-to-ams/3-deploy-to-cf.md @@ -4,190 +4,17 @@ Prepare your sample for deploying on Cloud Foundry: [Prerequisite-for-sample](./1-getting-started-with-ams.md). +## Deploy to Cloud -## Add Identity Authentication and Authorization Management +1. Prepare for production. +```sh +cds add mta,hana,approuter +``` - 1. Create `ias-config.json` file in your project root folder with the following content and replace the `````` with a unique value to identify your IAS app in IAS Tenant: +This adds the needed configuration for an SAP HANA database (needs to be provisioned in your account), fur using an approuter, and using MTA as deployment. - ```json - { - - "authorization": { - "enabled":true - }, - "provided-apis": [ - { - "name": "incidents-api", - "description": "api exposed by incident mgmt app" - } - ], - "display-name": "incident-ias-" - } - ``` - -2. Check if the following dependencies and dev dependencies have been added to the `package.json`: - - - - ```json - { - ... - "dependencies": { - "@sap/ams": "^1.18.1", - "@sap/cds": "^8.0", - "@sap/xssec": "^3.3.5", - "hdb": "^0.19.0", - "passport": "^0" - }, - "devDependencies": { - "@sap/ams-dev": "^1.3" - }, + - ... - } - ``` -3. Change the `auth.kind` to `ias` in `package.json` for the production profile: - - ```json - { - ... - "cds": { - "requires": { - "[production]": { - ... - "auth": { - "kind": "ias" - ... - } - } - } - } - } - ``` - -## Deploy on Cloud Foundry - -1. Update the `mta.yaml` with the following content - -- Change the dependency `incident-management-auth ` in `resources` from `xsuaa` service instance: - ```yaml - - name: incident-management-auth - type: org.cloudfoundry.managed-service - parameters: - config: - tenant-mode: dedicated - xsappname: incidents-${org}-${space} - path: ./xs-security.json - service: xsuaa - service-plan: application - ``` - -- To `ias` service instance: - ```yaml - - name: incident-management-auth - parameters: - path: ./ias-config.json - service-plan: application - service: identity - type: org.cloudfoundry.managed-service - ``` - - -- Add the following configurations to the `incident-management-srv` module - - - Change `incident-management-auth` service binding with `incident-management-srv` to: - ```yaml - - name: incidents-management-srv - type: nodejs - path: gen/srv - requires: - - name: incident-management-auth - parameters: - config: - credential-type: "X509_GENERATED" - ``` - - - Add `AMS_DCL_ROOT` to `properties` section - - ```yaml - properties: - AMS_DCL_ROOT: ams/dcl - ``` -- Add `incident-management-ams-policies-deployer` module in `mta.yaml` below `incident-management-srv` module: - ```yaml - - name: incident-management-ams-policies-deployer - type: javascript.nodejs - path: gen/policies - parameters: - buildpack: nodejs_buildpack - no-route: true - no-start: true - tasks: - - name: deploy-dcl - command: npm start - memory: 512M - requires: - - name: incident-management-auth - parameters: - config: - credential-type: X509_GENERATED - app-identifier: policy-deployer - ``` - - Delete `incident-management-auth` binding from `incident-management-destination-content` - ```yaml - - name: incident-management-auth - parameters: - service-key: - name: incident-management-auth-key - ``` - - Delete `incidents_incident_management_auth` destination from `incident-management-destination-content` - ```yaml - - Authentication: OAuth2UserTokenExchange - Name: incidents_incident_management_auth - ServiceKeyName: incident-management-auth-key - sap.cloud.service: incidents - ``` - - ### Note: - - Check if the module `incident-management-destination-content` in `mta.yaml` looks like this: - - ```yaml - - name: incident-management-destination-content - type: com.sap.application.content - requires: - - name: incident-management-destination-service - parameters: - content-target: true - - name: incident-management_html_repo_host - parameters: - service-key: - name: incident-management_html_repo_host-key - parameters: - content: - instance: - destinations: - - Name: incidents_incidents_management_html_repo_host - ServiceInstanceName: incident-management-html5-app-host-service - ServiceKeyName: incident-management_html_repo_host-key - sap.cloud.service: incidents - existing_destinations_policy: ignore - build-parameters: - no-source: true - ``` -- Update `incident-management-srv-api` destination in `incident-management-destination-service` - - - Add `HTML5.IASDependencyName: incidents-api` - - ```yaml - - Authentication: NoAuthentication - HTML5.IASDependencyName: incidents-api - Name: incidents-management-srv-api - ProxyType: Internet - Type: HTTP - URL: ~{srv-api/srv-url} - existing_destinations_policy: update - ``` 2. Update `app/incidents/xs-app.json` with the following code: ``` { @@ -226,18 +53,18 @@ Prepare your sample for deploying on Cloud Foundry: [Prerequisite-for-sample](./ > Change the `authenticationType ` of `incident-management-srv-api` and `html5-apps-repo-rt` from `xsuaa` to `ias` -6. Build the mtar. +3. Build the mtar. ``` mbt build ``` -7. Log in to your SAP BTP subaccount and choose your Cloud Foundry space where you want to deploy your application. +4. Log in to your SAP BTP subaccount and choose your Cloud Foundry space where you want to deploy your application. ``` cf login -a ``` -8. Deploy on Cloud Foundry. +5. Deploy on Cloud Foundry. ``` cf deploy mta_archive/.mtar From 1d76d65bc262a2aa238fa240309eb86b9ab31a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Fri, 14 Mar 2025 11:37:27 +0100 Subject: [PATCH 3/6] Update 3-deploy-to-cf.md --- documentation/xsuaa-to-ams/3-deploy-to-cf.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/documentation/xsuaa-to-ams/3-deploy-to-cf.md b/documentation/xsuaa-to-ams/3-deploy-to-cf.md index 159327e..ef6919d 100644 --- a/documentation/xsuaa-to-ams/3-deploy-to-cf.md +++ b/documentation/xsuaa-to-ams/3-deploy-to-cf.md @@ -7,11 +7,11 @@ Prepare your sample for deploying on Cloud Foundry: [Prerequisite-for-sample](./ ## Deploy to Cloud 1. Prepare for production. -```sh -cds add mta,hana,approuter -``` + ```sh + cds add mta,hana,approuter + ``` -This adds the needed configuration for an SAP HANA database (needs to be provisioned in your account), fur using an approuter, and using MTA as deployment. + This adds the needed configuration for an SAP HANA database (needs to be provisioned in your account), fur using an approuter, and using MTA as deployment. From d9e18de61a1585998c8dc68a3fc5e1c3fef5517d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Fri, 14 Mar 2025 11:38:13 +0100 Subject: [PATCH 4/6] Update documentation/xsuaa-to-ams/2-integrate-with-ams.md --- documentation/xsuaa-to-ams/2-integrate-with-ams.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/xsuaa-to-ams/2-integrate-with-ams.md b/documentation/xsuaa-to-ams/2-integrate-with-ams.md index 6656352..9bdcef0 100644 --- a/documentation/xsuaa-to-ams/2-integrate-with-ams.md +++ b/documentation/xsuaa-to-ams/2-integrate-with-ams.md @@ -9,7 +9,7 @@ ```sh cds add ams ``` - > This adds the needed cofiguration for AMS as well as IAS. + > This adds the needed configuration for AMS as well as IAS. 3. Install the added dependencies ```sh npm i From 339a8a83eb59a6466976db16c3063925d972d936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Fri, 14 Mar 2025 11:38:39 +0100 Subject: [PATCH 5/6] Update documentation/xsuaa-to-ams/3-deploy-to-cf.md --- documentation/xsuaa-to-ams/3-deploy-to-cf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/xsuaa-to-ams/3-deploy-to-cf.md b/documentation/xsuaa-to-ams/3-deploy-to-cf.md index ef6919d..3718c5f 100644 --- a/documentation/xsuaa-to-ams/3-deploy-to-cf.md +++ b/documentation/xsuaa-to-ams/3-deploy-to-cf.md @@ -11,7 +11,7 @@ Prepare your sample for deploying on Cloud Foundry: [Prerequisite-for-sample](./ cds add mta,hana,approuter ``` - This adds the needed configuration for an SAP HANA database (needs to be provisioned in your account), fur using an approuter, and using MTA as deployment. + This adds the needed configuration for an SAP HANA database (needs to be provisioned in your account), for using an approuter, and using MTA as deployment. From f04a449525f397d4c5506a9d27c80af3a1d480e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Fri, 14 Mar 2025 11:38:58 +0100 Subject: [PATCH 6/6] Update documentation/xsuaa-to-ams/3-deploy-to-cf.md --- documentation/xsuaa-to-ams/3-deploy-to-cf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/xsuaa-to-ams/3-deploy-to-cf.md b/documentation/xsuaa-to-ams/3-deploy-to-cf.md index 3718c5f..929f507 100644 --- a/documentation/xsuaa-to-ams/3-deploy-to-cf.md +++ b/documentation/xsuaa-to-ams/3-deploy-to-cf.md @@ -13,7 +13,7 @@ Prepare your sample for deploying on Cloud Foundry: [Prerequisite-for-sample](./ This adds the needed configuration for an SAP HANA database (needs to be provisioned in your account), for using an approuter, and using MTA as deployment. - + 2. Update `app/incidents/xs-app.json` with the following code: ```