Skip to main content

Security, Authentication & Safe Server Boundaries

The TicketOps Console starts closed behind a login gate; the signed-in identity is bound to the server session; TicketService checks the permission itself before closing or deleting a work order; user-typed notes go through a safe text/HTML policy; and every sensitive action — allowed or denied — lands in an append-only audit trail.

Nothing here is a real credential: three demo accounts in an in-memory store, compared on the server.

Run it

cd "LearnWisej-Samples/Production Architecture Deep Dive\Module 11\TicketOps"
dotnet run -f net10.0 --urls http://localhost:5111

Then open http://localhost:5111 (or open TicketOps.slnx in Visual Studio and press F5).

Demo accounts

UserRoleMay
l.romeroTechnicianview work orders, add notes
m.weberSupervisor+ close, delete
s.okaforAdmineverything

The screens

  • Sign in: user name, password, Sign in. A wrong password or an unknown user gets the same neutral message.
  • Work Orders: the signed-in user and Sign out, the work-order grid, a note box with Render ticket note and its two renderings (as text, and with the b/i/br allow-list), Close ticket, Delete ticket (disabled for a Technician), Force-enable Delete and the audit trail.

The lab asks you to show that an unauthorized action cannot run even when its control is enabled manually: sign in as l.romero, select #2002, click Force-enable Delete, then Delete ticket. The service refuses, the banner says You are not allowed to perform this action., and the audit trail gains a ⛔ DENIED DeleteTicket #2002 line. The video does the same from the browser console (btnDelete.disabled = false); the button here is buttonDelete.

Where things live

TicketOps/
├─ Views/ LoginView, WorkOrdersView
├─ Security/ Permission, UserContext, UserSession, PermissionService, AuthenticationService, HtmlPolicy
├─ Services/ ITicketService / TicketService (authorizes itself), IAuditService
├─ Domain/ Ticket (CanClose / Close), OperationResult
├─ Data/ IUserStore / InMemoryUserStore, ITicketRepository / InMemoryTicketRepository
├─ Infrastructure/ AuditLog, WisejSessionBinding, ILog/ActivityLog, AppComposition
├─ Resources/ Strings.cs
└─ docs/ SecurityChecklist, ThreatNotes, SafeHtmlPolicy, PermissionMatrix, ProductionReadinessNote