Skip to Content
1
Jun 12, 2018 at 08:21 AM

Getting Tenant ID Using Neo SDK

803 Views

Hello Everyone,

I am trying to build a multi-tenant application and I designed a simple architecture to understand the concept of multi-tenancy. Simply, I have a sapui5 and java application both running on SAP Cloud Platform Neo. Obviously, sapui5 is the front-end and the java app is back-end.

Tenants will subscribe to sapui5 application and sapui5 application will consume the services which is provided by java back-end. Services must be tenant specific. In order to achieve this I used Neo SDK.

Context ctx = new InitialContext();
TenantContext tenant = (TenantContext) ctx.lookup("java:comp/env/TenantContext");

This simple snippet of code which is in my java back-end can find Tenant ID. It extracts the tenant ID from the URL because URL's also contains information about tenants. But the problem occurs here. Sapui5 and java applications are in the same sub-account(dev) and when any of tenant uses sapui5 application same Tenant ID occurs. Because sapui5 communicates with java application using the URL which is created for dev sub-account and the tenant ID is dev sub-account's ID. Because of this situation, I can't discriminate tenants.

How can I overcome this problem ? Any help is appriciated, thanking in advance.