Day 5
TL;DR: Continued work on backend security β role-based access is now fully wired up.
β
Got fine-grained role-based access control fully working today.
β’ Roles loaded from PostgreSQL
β’ Injected into JWT during login
β’ Validated via custom `@Roles()` + `RolesGuard`
β’ Authenticated via `@UseGuards(JwtAuthGuard)` globally
β’ Introduced `@Public()` decorator to bypass guards for public endpoints
β’ Swagger supports Bearer token for testing
Took a while to get the role propagation into the token right β the key was enriching the `validateUser()` result, not just fetching data from DB.
Modular, clean, and no magic. Feels good. π
more on: https://write.as/bmariusz/continuation-securing-routes-with-jwt-and-role-based-access-control
#CloudNative #TypeScript #NestJS #Nextjs #InsuranceTech #Microservices #monorepo
#codingdays #swagger #jwt #jwt_auth #programming