
Start Application & Create Test Users
- Run your Spring Boot application
- Go to http://localhost:8080/register
- Create two test users: o User 1: email: admin@test.com, password: admin123, role: ADMIN o User 2: email: user@test.com, password: user123, role: USER
Test Login/Logout Flow
- Click "Logout" button
- Should redirect to login page
- Login with admin@test.com / admin123
- Should redirect to dashboard showing ADMIN role
Test API Endpoints from Dashboard While logged in as ADMIN: • Click "Test User Endpoint" → Should see: "Hello admin@test.com! You have USER access..." • Click "Test Admin Endpoint" → Should see: "Hello ADMIN admin@test.com!..."
Test Session Persistence
- Login successfully
- Close browser tab
- Open new tab, go to http://localhost:8080/dashboard
- Should still be logged in (JWT cookie working)
Test Token Expiration
- Login successfully
- Wait 1 hour (or change JWT expiration to 1 minute for testing)
- Try API calls → Should fail/redirect to login
Test Login Page
- Go to http://localhost:8080/login
- Enter credentials: o Email: admin@test.com o Password: admin123
- Click "Login" button
- Should redirect to dashboard if successful
Verify JWT Cookie is Set
- After successful login, press F12 (Developer Tools)
- Go to "Application" or "Storage" tab
- Click "Cookies" → http://localhost:8080
- Should see a cookie named "jwt" with a long token value

