Base proyect for spring jwt api. Exe JAR or gradle bootrun and consume API:
Authenticate:
curl -i -H "Content-Type: application/json" -X POST -d '{"username":"admin","password":"abc123.."}' http://localhost:8080/authenticateGet resources: (change "xxx.yyy.zzz" for token jwt)
curl -H "Authorization: Bearer xxx.yyy.zzz" http://localhost:8080/saludoNew user:
curl -i -H "Content-Type: application/json" -H "Authorization: Bearer xxx.yyy.zzz" -X POST -d '{"name": "newuser","password":"$2y$12$b69LWwDuQ7kARZQy9Hfpne938ArU6WHsZau9CEFnaVGUqX1oz0VBa","active":true,"roles":"ROLE_USER"}' http://localhost:8080/usersDelete user:
curl -i -H "Content-Type: application/json" -H "Authorization: Bearer xxx.yyy.zzz" -X DELETE http://localhost:8080/users/newuserGet one or all users:
curl -i -H "Content-Type: application/json" -H "Authorization: Bearer xxx.yyy.zzz" -X GET http://localhost:8080/users/newusercurl -i -H "Content-Type: application/json" -H "Authorization: Bearer xxx.yyy.zzz" -X GET http://localhost:8080/usersFor further reference, please consider the following sections:
- Official Gradle documentation
- Spring Boot Gradle Plugin Reference Guide
- Create an OCI image
- Spring Web
The following guides illustrate how to use some features concretely:
- Building a RESTful Web Service
- Serving Web Content with Spring MVC
- Building REST services with Spring
These additional references should also help you: