Skip to content

sophea/springboot2-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This project is about how to use spring security username/password from database and exchanging token using JWT

This is Spring Boot V2 Application for Securing a REST API with JSON Web Token (JWT). See more details : https://medium.com/@sopheamak/springboot-security-with-jwt-fca1446790ba

Technologies

  • Spring boot 2
  • JWT jjwt
  • Mysql
  • Database JPA

REST APIs

  • Register new user
curl -X POST \
  http://localhost:8080/register \
  -H 'content-type: application/json' \
  -d '{
"username":"test",
"password":"password"
}'
  • Login API to exchange token
curl -X POST \
  http://localhost:8080/auth/token \
  -H 'content-type: application/json' \
  -d '{
"username":"test",
"password":"password"
}'

response back 

{
    "token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0IiwiUk9MRVMiOlsiUk9MRV9VU0VSIl0sImV4cCI6MTU3ODE3ODI5NSwiaWF0IjoxNTc4MTYwMjk1fQ.gDMuDfp1_1kv729HrOWCskTm4rNCm7SSoniqDHZuRD5H1uUtFzbiktN9NVaTNaTvp14UqGavQygKhO3pTFOQJg"
}

About

springboot2 with JWT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages