This repository is related to spring boot security with JWT (JSON WEB TOKEN) .
In this project we will see how to configure InMemory user and JWT authentication using latest Spring Boot version 3.2.
Go to spring initializer and create new project with dependencies
Add the following dependencies
When you are trying to access the api without token :
For login : (http://localhost:8080/auth/login) : This api is permitted without the valid jwt token .
After hitting this api with valid payload , a JWT token will been generated with which you can access other protected api's.
After login :
When you are hitting any protected api you need to pass the generated jwt token with the api
Key : Authorization
value : Bearer + blank space + generated jwt token
In the below image you can see the difference when you pass a invalid jwt token and a valid jwt token.
When you pass a invalid jwt token you will get a message in the console as Invalid Header Value .