on 03-31-2022 2:32 PM
I am trying to deploy a multi-tenant application(Spring boot application) with SAAS service registry in the SAP CF.When i do the subscribing,I am getting the following error
Error :
I have created 3 End points in my Controller in Spring boot application:
Could someone please look into this and do the needful
You find an example here: Multi-tenancy of destination service with cloud foundry applications
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I'm wondering about the json structure in your response.
I've checked an example on my side, I'm returning a json like this:
res.status(200).json([{'xsappname': CREDENTIALS.uaa.xsappname }])
So I don't have the "dependencies" node, and I don't have an array of strings, but I have and array of objects with the propertyname "xsappname"
Maybe you can try adapting your response structure?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As far as I
understand the SaaS mechanism, the dependencies are meant to be used as
follows:
You write a
multi tenant aware app
Your app
has dependencies on other services
The other
services are multi-tenant aware as well
As such,
they need to be informed about your app
Like that,
the service can distinguish the tenants of your app, instead of the app as a
whole.
To achieve
it, the other services are added as dependencies in your MT app
So the other
services are invoked before your app is invoked
So the
other services as well define the MT callbacks which are invoked
The
saasregistry handles these tasks: build a dependency tree and invoke the
services and your app in the correct order.
As such, I
don’t think that you need to add the saasregistry as dependency in your app
Also the
xsuaa: in the xs-security.json, you declare that the xsuaa instance has
tenantMode:shared
It is anyways
treated as multitenant-aware service
So I don’t think you need to add it as dependency in your dependencies-callback
Kind
Regards,
Carlos
Hi,
the xs-security.json file is just a storage for configuration parameters.
Actually, you don't even need that file.
You need to pass configuration params, when creating the instance of the service.
You can pass these json params in the cloud cockpit in the wizard.
Or directly pass the json in the command line.
But best practice is to use a file and check it in github.
The name of the file is of your choice.
Also the location.
As mentioned, it is only required during instance creation
Approuter is a little application that is typically used together with web apps
Approuter is then placed in front of the web app.
The end user opens the approuter URL
approuter takes care of authentication (bound to xsuaa)
After login, approuter forwards the user to the web app
Approuter also is used to avoid CORS problem
Approuter supports multitenancy
But it is not a prerequisite.
If you use approuter, make sure to add the HOST_PATTERN variable to the manifest
Hello carlos.roggan ,According to your inputs,i have created a new XSUAA service with the below xs-security.json in the cockpit
{
"xsappname": "Exploration-tenant",
"tenant-mode": "shared",
"description": "Security profile of inventory management app",
"scopes": [{
"name": "$XSAPPNAME.Callback",
"description": "With this scope set, the callbacks for tenant onboarding, offboarding and getDependencies can be called.",
"grant-as-authority-to-apps": [
"$XSAPPNAME(application,sap-provisioning,tenant-onboarding)"
]
}]
}
I have also created the SAAS registry with the following config.json in the cockpit
{
"tenantmode" : "shared",
"appId": "multi-tenant-app-stestartplatform!t10211",
"displayName": "Forum Multi-tenant ",
"description": "A sample hello world app to explain the concepts of Multitenancy",
"category": "Provider ZZZ",
"appUrls": {
"onSubscription": "https://Exploration-tenant.cfapps.sap.hana.ondemand.com/callback/tenant/{tenantId}"
}
}
I have deleted the getDependencies endpoint in the Spring boot application,now there are only two endpoints 1) PUT(for tenant-onboarding) 2)DELETE (for tenant-offboarding)
Please find the below manifest.yml of the Spring boot application:
Now when i try to subscribe to the application,I am getting the following error...Could you please look into this and do the needful.
Hi,
Just guessing....
so you've added these 4 services as dependencies?
saasregistry,
connectivity,
destination,
xsuaa
?
Are you sure that you need dependency to saasregistry and xsuaa?
Have you checked if the <VCAP_SERVICES.<service>.credentials.xsappname always refurns a valid value?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,thanks for responding,Initially i have added all the 4(saasregistry,connectivity,destination,xsuaa) XSAPPNAME's in the getDependencies endpoint.I have also added them as services in the manifest.yml.Now i tried only adding connectivity's and destinations XSAPPNAME's but the result remains same,it is giving me the same error.and regarding "Have you checked if the <VCAP_SERVICES.<service>.credentials.xsappname always refurns a valid value?" I have given XSAPPNAMEs in a hardcoded manner.
Could you please look into this issue and do the needful....
I am pasting the Tenant onboarding and offboarding Controller code for your reference :
@PutMapping("/{tenantId}")
public void subscribeTenant(@PathVariable(value = "tenantId") String tenantId) {
logger.error("Tenant callback service was called with method PUT for tenant {}.", tenantId);
}
@DeleteMapping("/{tenantId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void unsubscribeTenant(@PathVariable(value = "tenantId") String tenantId) {
logger.error("Tenant callback service was called with method DELETE for tenant {}.", tenantId);
}
@GetMapping("/dependencies")
public ArrayList<deps> getDependancies(HttpServletRequest request, HttpServletResponse response) {
response.setStatus(200);
response.setContentType("application/json");
ArrayList<String> arr = new ArrayList<String>();
arr.add(CONNECTIVITY_XSAPPNAME);
arr.add(DESTINATION_XSAPPNAME);
deps d=new deps();
d.setDependencies(arr);
ArrayList<deps> res = new ArrayList<>();
res.add(d);
return res;
}
The error i was getting after i gave only Connectivity and Destination's XSAPPNAME's :
User | Count |
---|---|
82 | |
11 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.