Kind: Service
Source: Pams/API/Pams.API/Pams.API.csproj (line 1)
Part of: Pams
NuGet package dependency
SaasKit.Multitenancy.WebApi is a NuGet package dependency in the Pams API project that supports tenant-aware request handling for ASP.NET Web API. It helps the API identify the current tenant from incoming requests so tenant-specific context can be applied before application endpoints run.
Diagram
mermaidsequenceDiagram participant Client participant API as Pams API participant TenantMiddleware as SaasKit Multitenancy participant Endpoint Client->>API: Send request API->>TenantMiddleware: Process tenant context TenantMiddleware->>TenantMiddleware: Resolve current tenant TenantMiddleware->>Endpoint: Continue request with tenant context Endpoint-->>Client: Return response
Usage
tsasync function getTenantData(tenantId: string) {
const response = await fetch("/api/data", {
headers: {
"X-Tenant-Id": tenantId,
},
});
if (!response.ok) {
throw new Error("Unable to load tenant data.");
}
return response.json();
}
const data = await getTenantData("tenant-a");
console.log(data);
AI Coding Instructions
- Keep tenant resolution in the API request pipeline so endpoints receive an established tenant context.
- Confirm how the Pams API identifies tenants before adding request headers, host-based routing, or route-based tenant values.
- Do not trust tenant identifiers from client input without validating them against the authenticated user or request context.
- Preserve tenant context when adding API middleware, authentication handlers, or background request processing.
Used by
1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Injected or called by (1)
Pams.API—Pams/API/Pams.API/Pams.API.csproj:1
Was this page helpful?