The complete inventory of the Identity / Tenancy / Authorization subsystem — the multi-tenant, per-permission layer that every other module depends on. This is the "who are you / which company are you acting in / what are you allowed to do" layer.

Source of truth: written from the actual code — IdentityService.cs (3,642 lines), MembershipService.cs (2,641), AccountService.cs (1,121), AdminRolesService.cs (687), the CustomContextAccessorService tenancy resolver, IdentityModel.cs / AuthenticationModels.cs, the two DbContexts, and the frontend auth store + guards + roles/permissions UI. Frontend-driven claims not yet confirmed by driving the live product are marked ⚠️ VERIFY.

This subsystem is the designated home for the role-tier + per-permission model — People's RFD-004 hands that ownership here explicitly.


Backend scale (verified 2026-07-20)

Service Lines Role
IdentityService.cs 3,642 Authentication — login, token issuance, 2FA, SSO/OAuth, refresh, email/reset tokens
MembershipService.cs 2,641 Cross-org identity + roles/permissions read model — admin lists, org lookups, role & permission catalog, primary-admin transfer
AccountService.cs 1,121 Account lifecycle — password set/reset, email confirm, sessions, 2FA setup
AdminRolesService.cs 687 Custom roles CRUD (Create / Update / Delete / Check)
AccountDetailService.cs 598 Account detail read model
ControlAccountService.cs 296 Control-panel (internal staff) accounts
Total (core) ~9,000

Controllers & endpoint counts

Controller Route Endpoints Surface
IdentityController [controller] 4 Authenticate, Control/Authenticate (+ refresh/token)
AccountController [controller] 33 2FA (setup/enable/disable/verify ×8), password flows, sessions, email confirm, VerifyToken, GetUserSession
MembershipController [controller] 3 Membership/org read surface
Admin/RolesController Admin/Roles 17 Roles + permissions admin (custom roles, assignment)
Control/AccountsController Control/Accounts 13 Internal control-panel account admin

1. Authentication (login → token)

2. Two-factor authentication (2FA)