bilhej/backend/src/test/java/se/bilhalsning
Joakim Mörling 8a95483fb8 feat: add admin role support to backend JWT authentication
Add role-based access control to the backend authentication system. The User
entity now carries a role field (default 'user'), JWT tokens include a 'role'
claim, and the login endpoint populates it from the database.

Changes:
- User entity: add role column (VARCHAR(20), default 'user') with getter/setter
- JwtService: add generateToken(email, role) overload and extractRole(token)
- AuthController: pass user.getRole() on login, 'user' on register
- Flyway V3: ALTER TABLE users ADD COLUMN role
- Flyway V4: seed admin user (admin@bilhalsning.se, role='admin')
- AuthControllerTest: add tests for admin role in token, role from DB on login
- JwtServiceTest: add tests for role extraction and default role
- UserServiceTest: assert role defaults to 'user' on createUser
2026-05-14 12:38:55 +02:00
..
config feat: implement JWT authentication — service, filter, SecurityFilterChain 2026-05-01 17:38:17 +02:00
controller feat: add admin role support to backend JWT authentication 2026-05-14 12:38:55 +02:00
repository feat: implement JWT authentication — service, filter, SecurityFilterChain 2026-05-01 17:38:17 +02:00
security feat: add admin role support to backend JWT authentication 2026-05-14 12:38:55 +02:00
service feat: add admin role support to backend JWT authentication 2026-05-14 12:38:55 +02:00
BilHejApplicationTests.java feat: scaffold Spring Boot 4 backend with Gradle, Flyway, and H2 2026-05-01 00:28:10 +02:00
FlywayMigrationTest.java feat: implement JWT authentication — service, filter, SecurityFilterChain 2026-05-01 17:38:17 +02:00