ysf0 / jwt_spring_security_demo

JWT Spring Security Demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JWT Spring Security Demo

Simple demo using:

  • JSON Web Token (JWT)
  • Spring Security
  • Spring Boot

Requirements

  • Maven 3
  • Java 1.8

Usage

run Spring Boot maven plugin:

mvn spring-boot:run

Go to:

http://localhost:8080

Users

  • Admin - admin:admin
  • User - user:password
  • Disabled - disabled:password

User Passwords

https://en.wikipedia.org/wiki/Bcrypt is using to encode passwords.

Database

  • http://localhost:8080/h2-console/
  • This demo project use H2 db. If you want to change it, change the values of application.yml.
  • For other databases like MySQL sequences don't work for ID generation. So you have to change the GenerationType in the entity beans to 'AUTO' or 'IDENTITY'.

JWT-Decode

I use this library:

https://github.com/auth0/jwt-decode

jwt-decode is a small browser library that helps to decode JWTs token which are Base64Url encoded.

About

JWT Spring Security Demo

License:Apache License 2.0


Languages

Language:Java 81.8%Language:JavaScript 9.9%Language:HTML 8.4%