-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
27 lines (21 loc) · 1.37 KB
/
Program.cs
File metadata and controls
27 lines (21 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using AuthorizationExample;
Console.OutputEncoding = System.Text.Encoding.UTF8;
Console.WriteLine("╔══════════════════════════════════════════════════════════════╗");
Console.WriteLine("║ Authorization Example — Trellis ║");
Console.WriteLine("║ Same domain rules, two execution models ║");
Console.WriteLine("╚══════════════════════════════════════════════════════════════╝");
Console.WriteLine();
DirectServiceExample.Run();
Console.WriteLine();
await MediatorExample.RunAsync();
Console.WriteLine();
Console.WriteLine("Both approaches enforce the same domain rules:");
Console.WriteLine(" ✓ Resource-based auth (owner check via IAuthorizeResource<T>)");
Console.WriteLine(" ✓ Permission-based auth (static check via IAuthorize)");
Console.WriteLine(" ✓ Input validation (IValidate)");
Console.WriteLine();
Console.WriteLine("The difference: CQRS separates authorization from business logic.");
Console.WriteLine("Handlers contain zero auth code — pipeline behaviors handle it.");
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();