Skip to content

Commit 24cd0a7

Browse files
committed
chore: add targetURL option to iasBindingToDestination
1 parent a541e18 commit 24cd0a7

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

packages/connectivity/src/scp-cf/destination/service-binding-to-destination.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,20 +184,21 @@ async function xfS4hanaCloudBindingToDestination(
184184

185185
async function iasBindingToDestination(
186186
service: Service,
187-
options?: ServiceBindingTransformOptions & {
188-
resource?: string;
187+
options: ServiceBindingTransformOptions & {
188+
targetURL: string;
189+
resource: string;
189190
appTenantId?: string;
190191
extraParams?: Record<string, string>;
191192
}
192193
): Promise<Destination> {
193194
const { access_token } = await getIasClientCredentialsToken(service, {
194-
resource: options?.resource,
195-
appTenantId: options?.appTenantId,
196-
extraParams: options?.extraParams
195+
resource: options.resource,
196+
appTenantId: options.appTenantId,
197+
extraParams: options.extraParams
197198
});
198199
return buildClientCredentialsDestination(
199200
access_token,
200-
service.credentials.url,
201+
options.targetURL,
201202
service.name
202203
);
203204
}

packages/connectivity/src/scp-cf/identity-service.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ interface IasParameters {
4848
*/
4949
export async function getIasClientCredentialsToken(
5050
service: string | Service,
51-
options?: {
52-
resource?: string;
51+
options: {
52+
resource: string;
5353
appTenantId?: string;
5454
extraParams?: Record<string, string>;
5555
}
@@ -81,13 +81,9 @@ export async function getIasClientCredentialsToken(
8181
client_id: clientid
8282
});
8383

84-
if (arg.resource) {
85-
const fullResource = `urn:sap:identity:application:provider:name:${arg.resource}`;
86-
params.append('resource', fullResource);
87-
logger.debug(
88-
`Fetching IAS token with resource parameter: ${fullResource}`
89-
);
90-
}
84+
const fullResource = `urn:sap:identity:application:provider:name:${arg.resource}`;
85+
params.append('resource', fullResource);
86+
logger.debug(`Fetching IAS token with resource parameter: ${fullResource}`);
9187

9288
if (arg.appTenantId) {
9389
params.append('app_tid', arg.appTenantId);

0 commit comments

Comments
 (0)