Build secure spring boot REST API with spring security and JWT (JSON Web Token) authentication
- spring security in this project uses roles as authorization
- Every new user who registers to the app without assigning a specific role by default will have a ROLE_USER
- signup : POST
api/auth/signup
- login : POST
api/auth/login
- read user : GET
http://localhost:8080/api/users/{username}
- update user : PUT
http://localhost:8080/api/users/{username}
- delete user : DELETE
http://localhost:8080/api/users/{username}
- all ROLE_USER scope : GET, PUT, DELETE
http://localhost:8080/api/users/**
- read all users : GET
http://localhost:8080/api/users
- read all roles : GET
http://localhost:8080/api/roles
- read role : GET
http://localhost:8080/api/roles/{roleName}
- delete role : DELETE
http://localhost:8080/api/roles/{roleName}
- download or clone project from this repository
- create MySQL database
create spring_auth_demo
- open project with IDE or Text Editor
- change username and password
- open
src/main/resources/application.properties
- change
spring.datasource.username
andspring.datasource.password
- open
- Build and run using maven
mvn spring:boot run
- test with postman