Skip to content

Add Node.js part to Outbound Authentication#2596

Open
vkozyura wants to merge 10 commits into
mainfrom
outbound-auth-node
Open

Add Node.js part to Outbound Authentication#2596
vkozyura wants to merge 10 commits into
mainfrom
outbound-auth-node

Conversation

@vkozyura

Copy link
Copy Markdown
Contributor

No description provided.

@vkozyura vkozyura requested a review from renejeglinsky as a code owner May 28, 2026 08:27
@vkozyura vkozyura marked this pull request as draft May 28, 2026 08:27
@vkozyura vkozyura marked this pull request as ready for review June 5, 2026 13:13
@PDT42 PDT42 self-requested a review June 15, 2026 08:39

@PDT42 PDT42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this guide should use the Java / Node.js switch, if that is still a thing? The examples and required steps seem pretty disconnected.

Comment on lines +132 to +140
::: details Java configuration explained

The `type` property activates the protocol for exchanging business data and must be offered by the provider [CDS service](https://github.com/capire/xflights-java/blob/6fc7c665c63bb6d73e28c11b391b1ba965b8772c/srv/data-service.cds#L24).
The `model` property needs to match the fully qualified name of the CDS service from the imported model.
You can find CDS service definition of `sap.capire.flights.data` in file `target/cds/capire/xflight-data/service.cds` resolved during CDS build step.
The `binding.name` needs to point to the shared identity instance and `options.url` together with `http.suffix` provides the required location of the remote service endpoint.
Finally, `onBehalfOf: systemUser` specifies that the remote call is invoked on behalf of a technical user in context of the tenant.

:::

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this block to right after the Java specific example?

Comment on lines +142 to +149
::: details Node.js configuration explained

The `kind` property activates the protocol for exchanging business data (same as `type` in Java).
The key in `cds.requires` must match the fully qualified CDS service name (e.g., `sap.capire.flights.data`), which is the same name used in `cds.connect.to()`.
The `credentials.url` provides the full endpoint URL including the service path `/hcql/data`.
The `forwardAuthToken: true` enables direct forwarding of the incoming JWT token to the provider service - this is suitable for co-located services that share the same identity instance, as the token is already valid for the provider.

:::

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


::: tip
On behalf of `systemUser` works both in pure single tenant and in pure multitenant scenarios.
On behalf of `systemUser` (Java) works both in pure single tenant and in pure multitenant scenarios.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the updated structure, this jump back to Java systemUser is very disconnected. What is the / Is there an equivalent in Node.js?


Additionally, to establish the co-located setup, the microservice needs to share the same identity instance:
Additionally, to establish the co-located setup, the microservice needs to share the same identity instance.
This is configured in the MTA deployment descriptor (applies to both Java and Node.js):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"applied to both Java and Node.js" should be the default for any shared guide. IMO, only the opposite should be noted.

::: code-group

```yaml [/srv/srv/main/resources/application.yaml]
```yaml [mta.yaml]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mta.yaml makes sense to me, reading resources .. but his change still looks suspicious.

Comment on lines +456 to +476
**2. BTP Destination** - Create a destination in BTP Cockpit with these properties:

| Property | Value |
|----------|-------|
| Name | `xflights-ias-app2app` |
| Type | `HTTP` |
| URL | `https://<xflights-srv url>` |
| Proxy Type | `Internet` |
| Authentication | `OAuth2ClientCredentials` or `OAuth2JWTBearer` |
| Client ID | Consumer IAS client ID |
| Client Secret | Consumer IAS client secret |
| Token Service URL | `https://<IAS tenant>/oauth2/token` |
| Token Service URL Type | `Dedicated` |

**Additional Property (required for IAS App-2-App):**

| Property | Value |
|----------|-------|
| `tokenService.body.resource` | `urn:sap:identity:application:provider:name:data-consumer` |

The key is `tokenService.body.resource` which passes the `resource` parameter to IAS, triggering App-2-App token scoping and adding the `ias_apis` claim.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not tell people how they can specify the destination in their mta instead?

EDIT: Justified in **Note:** MTA cannot resolve cross-service credential references like ${generated>xtravels-ias/clientid}. The destination must be created manually in BTP Cockpit or via Destination Service API. - later on. Is that note accurate?

Comment on lines +478 to +482
**3. Authentication type depends on use case:**
- **OAuth2ClientCredentials**: For technical user scenarios (no user context)
- **OAuth2JWTBearer**: For user propagation (requires user token from authorization_code flow)

Both support `tokenService.body.resource` for IAS App-2-App scoping.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these two listed, but none of the other auth types?

Comment on lines +465 to +466
| Client ID | Consumer IAS client ID |
| Client Secret | Consumer IAS client secret |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do people get these?

1. Select **Applications & Resources** > **Applications**. Choose the IAS application of the `xtravels` consumer from the list.
2. In **Application APIs** select **Dependencies** and click on **Add**.
3. Type `data-consumer` as dependency name (needs to match property value `ias-dependency-name`) and pick provided API `data-consumer` from the provider IAS application `xflights`.
3. Type `data-consumer` as dependency name (needs to match property value `ias-dependency-name` in Java, or the dependency name in `tokenService.body.resource` for Node.js) and pick provided API `data-consumer` from the provider IAS application `xflights`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"... in Java, or the dependency name in tokenService.body.resource for Node.js" - what is the "dependency name"?

Comment on lines +579 to +583
- **Don't write custom integration logic** for consumed services unless necessary.
Leverage CAP's remote service architecture when possible to ensure a seamless integration experience.

- **Don't implement connectivity layer code** (for example, to fetch or exchange tokens).
Instead, rely on the shared connectivity component, which ensures centralized and generic processing of outbound requests.
- **Don't implement connectivity layer code** (for example, to fetch or exchange tokens) unless necessary.
Rely on the shared connectivity component, which ensures centralized and generic processing of outbound requests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO these changes just weaken the "Pitfalls" section.

@renejeglinsky

Copy link
Copy Markdown
Contributor

Perhaps this guide should use the Java / Node.js switch, if that is still a thing?

It's not a thing anymore. But code groups that have Java/Node are now remembered by selection without the toggle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants