This Project uses JWT to secure the REST endpoints.
The Following are the REST end points available in the example.
/login
- Generates the JWT token based on the JSON sent. Its a POST method which expects the JSON:{ "username": "name", "id": 123, "role": "admin"}
/rest/hello/user
- Requires a JWT Token with Headerkey - "Authorization"
andvalue - "Bearer <JWT_Token>"
keytool -genkey -keyalg RSA -alias jwtkey -keystore keystore.jks -storepass XXXX -validity 360 -keysize 2048
keytool -list -rfc -keystore keystore.jks -alias jwtkey -storepass xxxx | openssl x509 -outform der -out cert1.der
rest/hello/user
- This REST API is availabe forROLE_USER
,ROLE_POWERUSER
,ROLE_ADMIN
rest/hello/power
- This REST API is availabe forROLE_POWERUSER
,ROLE_ADMIN
rest/hello/admin
- This REST API is availabe forROLE_ADMIN