ADR-001: Multi-Tenant URLs in TMF APIs


Jun 14, 2024

PROPOSED

Emil Borowiec, Martin Goldhahn, Eivinn Hustveit

#tmf

Technical Story: https://jira.altibox.net/browse/PSA-1

Context and Problem Statement

All of Plattform's applications have to support multi-tenancy (see target architecture). TMForum's APIs do not support multi-tenancy directly (see https://engage.tmforum.org/communities/community-home/digestviewer/viewthread?GroupId=31&MessageKey=4381fd3f-bb5f-4a61-a9d2-2622dc9d5b4e&CommunityKey=d543b8ba-9d3a-4121-85ce-5b68e6c31ce5&tab=digestviewer).

It was proposed to extract the tenant from the authentication token. But some tenants have access to the data of several other tenants and a request to the API should not result in an aggregated result. Still the token still needs the tenant and the application has to check whether the token actually gives access to the requested tenant data.

Decision Drivers

The product catalog needs an answer how to handle this in the BECS project.

Considered options

  1. Use the tenant from the authentication token
  2. https://server/TENANT_ID/APP_URI/API_URI/API_VERSION/TMF_API_ENDPOINT e.g. https://products.lyse.no/1014/tmf-api/productCatalog/v4/catalog
  3. https://server/APP_URI/TENANT_ID/API_URI/API_VERSION/TMF_API_ENDPOINT e.g. https://products.lyse.no/tmf-api/1014/productCatalog/v4/catalog
  4. https://server/APP_URI/API_URI/TENANT_ID/API_VERSION/TMF_API_ENDPOINT e.g. https://products.lyse.no/tmf-api/productCatalog/1014/v4/catalog
  5. https://server/APP_URI/API_URI/API_VERSION/TENANT_ID/TMF_API_ENDPOINT e.g. https://products.lyse.no/tmf-api/productCatalog/v4/1014/catalog

Decision Outcome

Option 3 is chosen, The tenant is added to the basePath of the URL, like: https://products.lyse.no/tmf-api/1014/v4/catalog to list the catalog for tenant 1014.

Consequences

Consistent pattern for how to add the tenant to TMF APIs.