You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update README and documentation for email verification and role management
- Enhanced README to reflect the introduction of email verification and hybrid RBAC.
- Updated API documentation to clarify login requirements and JWT claims, including new roles and email verification processes.
- Added details on the X-Tenant-Id header and its significance for SystemAdmin operations.
- Revised deployment documentation to include email verification settings and their implications in production.
- Introduced new file for temporary cookies generated during development.
Copy file name to clipboardExpand all lines: README.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
# Multi-Tenant Platform
2
2
3
-
.NET **10** multi-tenant SaaS API with JWT authentication, permission-based RBAC, tenant isolation, and automated production deploys.
3
+
.NET **10** multi-tenant SaaS API with JWT authentication, hybrid RBAC, complete tenant isolation, email verification, and automated production deploys.
4
4
5
5
## Documentation
6
6
7
7
| Document | Description |
8
8
|----------|-------------|
9
-
|[docs/PROJECT.md](docs/PROJECT.md)| Architecture, auth, data model, migrations & seeds |
|[docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)| GitHub Actions → MonsterASP.NET (FTP) production deploy |
12
12
13
13
## How it works (workflow)
@@ -26,8 +26,8 @@
26
26
27
27
On every app start (local or production):
28
28
29
-
1.**Migrations** — pending EF migrations from `__EFMigrationsHistory` are applied (`ApplyMigrationsOnStartup`).
30
-
2.**Seeds** — pending versioned seeds from `SeedHistory` are applied (`ApplySeedsOnStartup`). Already-applied seeds are skipped.
29
+
1.**Migrations** — pending EF migrations from `__EFMigrationsHistory` are applied.
30
+
2.**Seeds** — pending versioned seeds from `SeedHistory` are applied. Already-applied seeds are skipped.
31
31
32
32
Schema baseline: single migration **`InitialCreate`**. Seed versions are tracked like migrations.
33
33
@@ -45,6 +45,8 @@ dotnet user-secrets set "ConnectionStrings:DefaultConnection" "Server=localhost\
45
45
46
46
Or rely on [appsettings.Development.json](src/Api/appsettings.Development.json) for local SQL/JWT (dev only).
47
47
48
+
In Development, `Features:RequireEmailVerification` is `false` — newly created users can log in immediately without completing email verification. Set it to `true` (the production default) to test the OTP flow.
49
+
48
50
### 2. Run the API
49
51
50
52
```powershell
@@ -66,7 +68,7 @@ Open:
66
68
- Health: `GET /api/v1/health`
67
69
- API base: `/api/v1`
68
70
69
-
**Default SuperAdmin** (after seeds): `admin@system.com` / value of `Seeding:AdminPassword` (e.g. `Admin123!` in Development).
71
+
**Default SystemAdmin** (after seeds): `admin@system.com` / value of `Seeding:AdminPassword` (e.g. `Admin123!` in Development).
70
72
71
73
### 3. Add a migration (developers)
72
74
@@ -89,18 +91,24 @@ See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) for production deploy.
89
91
90
92
- Deploy: push to **`master`** or run **Deploy to MonsterASP (FTPS)** workflow.
- Email verification is **on** by default in production (`Features:RequireEmailVerification: true`). New users must verify their email via OTP before logging in.
92
95
- Swagger: `https://<your-site>/swagger` — open (set `Swagger:EnabledInProduction` to `false` to hide it).
93
96
- Fresh database: delete and recreate the database in the MonsterASP control panel (or drop all tables in SSMS), then redeploy.
94
97
95
98
## Highlights
96
99
97
-
-**Permissions**: PascalCase (`Users.View`); checked per request, **not** in JWT
98
-
-**JWT claims**: `user_id`, `tenant_id`, `role_id`, role names
100
+
-**Hybrid RBAC**: Layer 1 = `SystemRole` on `ApplicationUser` (ceiling authority); Layer 2 = custom roles with permissions (TenantUser business capabilities only)
101
+
-**Three system roles**: `SystemAdmin` (platform), `TenantAdmin` (manages one tenant), `TenantUser` (operational)
102
+
-**X-Tenant-Id header**: SystemAdmin must supply `X-Tenant-Id` on all tenant-scoped requests; TenantAdmin/TenantUser are always pinned to their JWT `tenant_id`
103
+
-**Email verification**: OTP-based (6-digit, 15 min); skipped in Development via `Features:RequireEmailVerification: false`
104
+
-**Permissions**: PascalCase (`Users.View`); checked per request from DB (cached), never in JWT
0 commit comments