Skip to main content

API Tenant Context

Summary

Extracted Recruitment resolves tenant context from identity claims or forwarded request context and uses global query filters. Monolith lifecycle APIs derive tenant from the current user/request and filtered application context. Public offer operations resolve ownership from the link lookup.

Audience

Developers, QA, support, security reviewers, and solution architects.

Tenant resolution flow

Extracted behavior

Missing required tenant context raises an application exception that the host maps to a bad-request response. Native and non-public compatibility commands use this context. Public offer repositories intentionally perform cross-tenant lookup by link value and then use the entity's tenant.

Recruitment completion sends explicit tenant context to Employee Service. No user credential is forwarded with that call.

Monolith behavior

HR Operations uses current-user tenant, target-user validation, visible-user scopes, and database query filters. Public Recruitment offer methods bypass normal query filters to find a link across tenants, then operate on linked records.

Isolation concern

The extracted active-onboarding lookup ignores global filters and selects by offer identifier plus active status without an explicit tenant predicate. The identifier is globally unique, but this still requires security review because it bypasses the default tenant guard.

Development aliases present in source are intentionally not reproduced and are not production tenant controls.

Requires confirmation

  • The authoritative trusted-forwarding contract between gateway and services.
  • Public-link entropy, expiry, revocation, and tenant-isolation tests.
  • Explicit tenant assertion for the active-onboarding lookup.
  • Whether every downstream service validates forwarded tenant context independently.

Source References

  • microservices/src/gateway-api/Program.cs
  • microservices/src/recruitment-service/Infrastructure/Persistence.cs
  • microservices/src/recruitment-service/Infrastructure/RecruitmentDbContext.cs
  • microservices/src/recruitment-service/Program.cs
  • microservices/src/recruitment-service/Infrastructure/EmployeeServiceClient.cs
  • Controllers/RecruitmentController.cs
  • Controllers/HrOperationsController.cs
  • Data/AppDbContext.cs

See Also

Keywords

  • Tenant filtering
  • Public link lookup
  • Isolation review

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-20
  • Review cycle: Quarterly