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), theCustomContextAccessorServicetenancy resolver,IdentityModel.cs/AuthenticationModels.cs, the twoDbContexts, 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.
| 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 |
| 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 |
IdentityController.Authenticate → IdentityService.Authenticate(AuthenticationRequest) — username + password, returns AuthenticationResponse carrying a JWT.Control/Authenticate → ControlAuthenticate(username, password) — internal PaidHR staff.SsoAuthenticate(SsoAuthenticationRequest), OAuthAuthenticate(OAuthAuthenticationRequest) — Google + Microsoft (frontend: GoogleLogin.tsx, MicrosoftLogin.tsx, onboarding/SSO.tsx).RefreshAccessToken (RefreshTokenRequest / TokenRefreshRequest).SignInStatusParams): Success, Failed, TwoFactorRequired, TwoFactorSetupRequired, PasswordResetRequired, LockedOut, NotAllowed.pages/auth/Login.tsx, useHandleLogin.ts, auth store stores/auth.ts.2fa/Details, 2fa/Setup_Info, 2fa/Admin_Setup_Info, 2fa/Enable, 2fa/Enable_Admin, 2fa/Disable, 2fa/SendCode, 2fa/VerifyCode, 2fa/VerifyAdminCode.TwoFactorAuthenticate, TwoFactorCodeVerify, GenerateTwoFactorAuthenticationToken, EnableAdminTwoFactorAuthentication, ControlTwoFactorAuthenticate; key stored via GetTwoFactorAuthenticationKey.pages/2fa/* (Admin2FASetupPage.tsx, context/2faContext.tsx).