This project provides an example of implementing JWT (JSON Web Token) authentication in a Spring Boot application. With JWT authentication, users can register, authenticate, and access protected resources using JSON Web Tokens.
- User registration
- User authentication
- JWT token generation and validation
- Role-based access control (RBAC)
- Stateless authentication
-
Clone the project:
git clone https://github.com/your-username/spring-boot-jwt-authentication.git
-
Navigate to the project directory:
cd spring-boot-jwt-authentication
-
Compile and run the application:
./mvnw spring-boot:run
-
Access the application at http://localhost:8080.
- URL:
/api/v1/auth/register
- Method:
POST
- Request Body (Istek Govdesi):
{
"firstname": "John",
"lastname": "Doe",
"email": "john@example.com",
"password": "password"
}
- URL: /api/v1/auth/authenticate
- Method: POST
- Request Body (Istek Govdesi):
{
"email": "john@example.com",
"password": "password"
}
- URL: /api/v1/protected
- Method: GET
- Headers (Basliklar): Authorization: Bearer <JWT_TOKEN>
This project is based on the tutorial "Securing Your Spring Boot Applications with JSON Web Tokens (JWT)" by Ali Boukari. This tutorial provides a comprehensive guide to implementing JWT authentication in Spring Boot applications.