Skip to content

Tenant Service Status

Overall Status: 100% MVD COMPLETE ✅ Location: src/Services/Sorcha.Tenant.Service/Last Updated: 2026-03-01


Summary

ComponentStatusLOCTests
Service Implementation✅ 100% MVD~3,000N/A
Integration Tests✅ Complete~1,80067 (61 passing)
Test Infrastructure✅ Complete~350N/A
TOTAL✅ 100% MVD~5,15091% pass rate

Service Implementation - 100% MVD COMPLETE ✅

1. Organization Management

  • ✅ Create, read, update, delete organizations
  • ✅ Organization status lifecycle (Active, Suspended, Deactivated)
  • ✅ Subdomain-based multi-tenancy
  • ✅ Organization user management (add, remove, update roles)

2. User Authentication

  • ✅ Token revocation (individual tokens)
  • ✅ Token introspection
  • ✅ Token refresh
  • ✅ Logout endpoint
  • ✅ Bulk token revocation (by user, by organization)
  • ✅ Current user info endpoint (/api/auth/me)

3. Service-to-Service Authentication

  • ✅ Service principal registration
  • ✅ Client credentials token endpoint
  • ✅ Delegated token endpoint
  • ✅ Secret rotation
  • ✅ Service principal lifecycle (suspend, reactivate, revoke)

4. Infrastructure

  • ✅ PostgreSQL via Entity Framework Core
  • ✅ Redis for caching and token management
  • ✅ .NET Aspire integration

Integration Tests - 91% PASSING ✅

Test Infrastructure

  1. TenantServiceWebApplicationFactory (162 lines)

    • ✅ Custom WebApplicationFactory
    • ✅ In-memory database (EF Core InMemory)
    • ✅ Mock Redis using Moq
    • ✅ Test authentication handler
    • ✅ Helper methods: CreateAuthenticatedClient(), CreateAdminClient(), CreateUnauthenticatedClient()
  2. TestAuthHandler (67 lines)

    • ✅ Custom authentication handler
    • ✅ Role mapping via X-Test-Role header
    • ✅ User ID mapping via X-Test-User-Id header
  3. TestDataSeeder (124 lines)

    • ✅ Consistent test data seeding
    • ✅ Well-known test organization: 00000000-0000-0000-0000-000000000001
    • ✅ Well-known test users:
      • Admin: 00000000-0000-0000-0001-000000000001
      • Member: 00000000-0000-0000-0001-000000000002
      • Auditor: 00000000-0000-0000-0001-000000000003

Test Files

Test ClassTestsStatusCoverage
OrganizationApiTests.cs2926 passingOrganization CRUD, user management
AuthApiTests.cs1817 passingToken operations, auth endpoints
ServiceAuthApiTests.cs2018 passingService principals, client credentials
TOTAL6761 passing (91%)

Test Categories

Organization API Tests (29):

  • Create organization (validation, duplicates)
  • Get organization by ID, subdomain
  • List organizations (pagination)
  • Update organization (name, status)
  • Delete organization (hard delete, cascade)
  • User management (add, remove, update roles, list users)
  • Organization status lifecycle (suspend, activate)

Auth API Tests (18):

  • Health check endpoint
  • Token revocation (valid token, empty token)
  • Token introspection (valid JWT, invalid token)
  • Get current user (authenticated, unauthenticated)
  • Logout (authenticated, unauthenticated)
  • Bulk token revocation (by user, by organization)
  • Token refresh (invalid token, empty token)

Service Auth API Tests (20):

  • Client credentials token (invalid creds, invalid grant type, missing fields)
  • Delegated token (invalid creds, missing user ID)
  • Service principal registration (unauthorized, forbidden, admin success)
  • List service principals (unauthorized, forbidden, admin success)
  • Get service principal (by ID, by client ID, not found)
  • Update service principal scopes
  • Service principal lifecycle (suspend, reactivate, revoke)
  • Secret rotation (invalid creds, missing fields, valid rotation)

Completed (Phase E - 2026-03-01)

  • ✅ Service principals includeInactive filter
  • ✅ Organization stats user count
  • ✅ Rate limiting for auth endpoints
  • ✅ Audit logging for security events

Deferred (Post-MVD)

  • Azure AD B2C integration (optional for production)

Back to: Development Status

Released under the MIT License.