Spring Security JWT Authentication example – RestAPIs SpringBoot + Spring MVC + Spring JPA + MySQL
JSON Web Token defines a compact and self-contained way for securely transmitting information as a JSON object.
In the tutorial, we show how to build a SpringBoot Security RestAPIs with JSON Web Token (JWT).
Related posts:
- Spring Security – JDBC Authentication – SpringBoot + MySQL + Bootstrap
- SQL Tutorial – MySQL Many-to-Many Relationship
- Spring JPA Hibernate Many to Many – SpringBoot + PostgreSQL
Series:
Spring Security – JWT Authentication Architecture | Spring Boot
Technologies
- Spring Boot
- jjwt - 0.9.0
- Spring Security
- Spring JPA
- MySQL
JSON Web Token
JSON Web Token (JWT) defines a compact and self-contained way for securely transmitting information between parties as a JSON object.
Scenarios where JSON Web Tokens are useful:
- Authorization: the most common scenario for using JWT. Single Sign On is a feature that widely uses JWT
- Information Exchange: Because JWTs can be signed, JSON Web Tokens are a good way of securely transmitting information between parties.
JSON Web Tokens consist of 3 parts:
- Header
- Payload
- Signature
-> JWT
looks like Header-Base64-String.Payload-Base64-String.Signature-Base64-String
Header consists of two parts:
- token type.
- hashing algorithm.
-> Example:
More at:
Spring Security JWT Authentication example – RestAPIs SpringBoot + Spring MVC + Spring JPA + MySQL
Top comments (1)
Any idea how to get the custom header value inside configure method in spring security?