Example SparkJava - JWT integration
ENDPOINT | HTTP METHOD | PARAMS | DESCRIPTION |
---|---|---|---|
/auth/register | POST | JSON body mandatory fields: userName, password. Additional fields firstName, secondName | New user registration |
/auth/login | POST | JSON body mandatory fields: userName, password | User login |
HTTP Header: Authorization: Bearer JWTToken
ENDPOINT | HTTP METHOD | PARAMS | DESCRIPTION |
---|---|---|---|
/auth/token | POST | JWT token refresh | |
/auth/logout | POST | JWT token revocation | |
/auth/me | GET | User details |
- ADMIN
- MANAGER
- DEVELOPER
ENDPOINT | HTTP METHOD | PARAMS | DESCRIPTION |
---|---|---|---|
/auth/roles | POST | JSON body mandatory fields: userName, role | Add new Role to user |
/auth/roles | DELETE | JSON body mandatory fields: userName, role | Revoke Role from User |
Predefined Admin user (admin/admin)
Cron job (every minute) to clean up revoked JWT Tokens