docs(multitenant): define Step 2 resource routing and security architecture - #829
Open
andrea-putzu wants to merge 6 commits into
Open
docs(multitenant): define Step 2 resource routing and security architecture#829andrea-putzu wants to merge 6 commits into
andrea-putzu wants to merge 6 commits into
Conversation
…entation for runtime tenant resource routing and strict isolation (Step 2)
andrea-putzu
requested review from
a team,
fabiosalamonenttdata,
giampiero-ferrara and
giulia-tremolada
as code owners
September 7, 2026 15:51
…nboarding services
…on and update configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
List of Changes
selfcare-sdk-tenant:TenantContext(request-scoped, fail-closed tenant resolution) andTenantRegistry, which parses a single JSON registry (one entry per tenant withaccount,database,connectionStringEnvVar) and resolves each tenant's Mongo connection string from an environment variable, sanitizing HTML-encoded&in Cosmos connection strings.selfcare-sdk-tenant-mongodb: a CDI producer (TenantMongoClientProducer) that builds oneReactiveMongoClientper configured tenant, replicating Quarkus' own codec setup (default BSON codecs + automatic POJO codec provider) so Panache entities are correctly encoded/decoded, plusTenantMongoDatabaseResolverto pick the right Mongo database per request based on the current tenant.apps/onboarding-ms:tenantIdto theOnboardingandTokenentities.OnboardingRepositoryand addedTokenRepositoryto route all Mongo queries through the tenant-aware client/database instead of a single global connection string.MONGODB_CONNECTION_STRING/quarkus.mongodb.connection-stringconfiguration; the service now resolves the correct dedicated Cosmos DB Mongo account (AR or PNPG) purely from the tenant registry at startup.tenant.supported-tenantsproperty.infra/resources/onboarding-ms/*) for all environments (dev/uat/prod, AR/PNPG) to injectMONGODB_CONNECTION_STRING_AR/MONGODB_CONNECTION_STRING_PNPGfrom Key Vault instead of the single legacy connection string secret.Database_identification.mddoc explaining how the correct Mongo database is resolved at runtime.Motivation and Context
Step 2 formalizes the architecture, security controls, and concrete implementation required to move onboarding-ms from a single shared Cosmos DB Mongo database to a shared backend that safely serves two dedicated tenants (AR and PNPG).
The documentation establishes a single validated tenant context for resource selection, prevents default-tenant fallbacks, and preserves tenant identity across synchronous workflows. The implementation removes any direct, tenant-unaware Mongo configuration from the application: instead of a single
MONGODB_CONNECTION_STRING, the service reads a dynamic JSON tenant registry at startup and resolves, per request, which dedicated Cosmos DB Mongo account/database to use based on the authenticated tenant — never falling back to a default database.It also clarifies the secret boundary: Container Apps use their managed identity to resolve Key Vault-backed secrets, while Cosmos DB Mongo clients authenticate with the injected, tenant-specific connection strings. Mongo authentication through Managed Identity remains explicitly out of scope.
How Has This Been Tested?
mvn -f libs/selfcare-sdk-tenant/pom.xml testandmvn -f libs/selfcare-sdk-tenant-mongodb/pom.xml test(unit tests forTenantRegistryandTenantMongoDatabaseResolver).mvn -f apps/onboarding-ms/pom.xml clean install(unit tests, including Cucumber suites) after wiring the tenant-aware repositories.quarkus:devthat onboarding read/write operations are routed to the correct dedicated Cosmos DB Mongo account (AR vs PNPG) based on the resolved tenant, and that the Panache codec/connection-string issues encountered during development (HTML-encoded&, missing POJO codec registry) are resolved.Screenshots (if appropriate):
Not applicable; this pull request contains documentation, shared libraries, and application/configuration changes only.
Types of changes
Checklist: