-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Describe the Question
Hi Team,
I have the below scenario
There is a leading SaaS application bound to dms(btp service). When a tenant 1 subscribes to this app a token is generated to call api's of dms service. when tenant 2 subscribes to this app the token is same but i want a different token.
async function transformSDMServiceBindingToClientCredentialsDestination(service, options,subdomain) {
// Extract tenant subdomain and replace provider subdomain in UAA URL for multi-tenant support
console.log("SUBDOMAIN IN ***** "+subdomain);
let uaaUrl = service.credentials.uaa.url;
if(!subdomain)
subdomain = cds.context?.user?.authInfo?.token?.payload?.ext_attr?.zdn;
if (subdomain && uaaUrl.includes('://')) {
const providerSubdomain = uaaUrl.substring(uaaUrl.indexOf('://') + 3, uaaUrl.indexOf('.'));
uaaUrl = uaaUrl.replace(providerSubdomain, subdomain);
}
console.log("SUBDOMAIN LATER ***** "+subdomain);
const transformedService = {
...service,
credentials: { ...service.credentials.uaa, url: uaaUrl }
};
const token = await serviceToken(transformedService, options);
return buildClientCredentialsDestination(
token,
uaaUrl,
service.name
);
}this is the method used. The clientId and client secret remains the same only the auth url changes based on subdomain to generate the token. How can this be achieved.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested