Skip to content

givanthak/spring-boot-rest-api-auth-jwt-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Known Vulnerabilities

Sample REST CRUD API Securing with Spring Security and JWT

Steps to Setup

1. Clone the application

https://github.com/givanthak/spring-boot-rest-api-auth-jwt-tutorial.git

2. Create Mysql database

create database user_database

3. Change mysql username and password as per your installation

  • open src/main/resources/application.properties

  • change spring.datasource.username and spring.datasource.password as per your mysql installation

4. Build and run the app using maven

mvn package
java -jar target/spring-boot-rest-api-auth-jwt-tutorial-0.0.1-SNAPSHOT.jar

Alternatively, you can run the app without packaging it using -

mvn spring-boot:run

The app will start running at http://localhost:8080.

Explore Rest APIs

The app defines following CRUD APIs.

GET /api/v1/users

POST /api/v1/users

GET /api/v1/users/{userId}

PUT /api/v1/users/{userId}

DELETE /api/v1/users/{userId}

POST  /api/v1/auth/login

Create User

POST /api/v1/users

{
	"username": "givantha90",
	"password": "welcome@123",
    "firstName": "Givantha",
    "lastName": "Kalansuriya",
    "email": "givanhta@gmail.com",
    "createdBy": "Givantha",
    "updatedBy": "Givantha"
}

POST  /api/v1/auth/login

{
    "username": "givantha12",
    "password": "welcome@123"
}

You can find the tutorial for this application on my blog -

https://www.prathapgivantha.wordpress.com

About

Sample REST CRUD API Securing with Spring Security and JWT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages