Security
Authentication model
- Access tokens are JWT bearer tokens
- Refresh tokens are persisted in
auth-service - Frontend stores tokens through
tokenStorage - Frontend retries once on
401by calling/auth/refresh
Authorization model
Frontend
ProtectedRouteblocks anonymous usersRoleGuardrestricts role-specific route treeshomePathForRole()sends admins to/admin/dashboardand customers to/dashboard
Backend
Every service validates JWTs independently with its own JwtAuthenticationFilter.
Examples:
analytics-service:/analytics/**requiresADMINbook-service: mutations requirehasRole('ADMIN')user-service: update is admin-or-self; delete is admin and not selforder-service: all routes require authentication; service layer also checks self-vs-admin
Password handling
auth-service uses BCryptPasswordEncoder.
Token flow
Public endpoints by service
auth-service: login, register, refresh, logoutuser-service:/api/user/createpayment-service:/api/payments/webhook,/actuator/healthbook-service:/actuator/health,/actuator/infoanalytics-service:/actuator/health,/actuator/info
Current gaps to be aware of
- Some local
application.ymlfiles still contain default JWT secrets in source for non-production use - No centralized authorization service is present; each service validates JWTs separately