A secure REST API implementation using Spring Boot and JWT (JSON Web Token) authentication.
- JWT-based authentication
- MySQL database integration
- Spring Security implementation
- RESTful API endpoints
- User registration and authentication
- Secure password handling
- Java 17 or higher
- Maven
- MySQL Server (running on port 3307)
The application requires the following environment setup:
- MySQL database running on port 3307
- Database name:
taskdb - Default credentials:
- Username:
root - Password:
secret
- Username:
You can modify these settings in src/main/resources/application.properties.
- Clone the repository
- Install dependencies:
mvn installTo start the application:
mvn spring-boot:runThe server will start on port 8005.
- JWT secret key is configured in
application.properties - Token expiration time is set to 1 hour (3600000 milliseconds)
- Hibernate is configured to automatically update the database schema
The API provides the following endpoints:
/api/auth/register- Register a new user/api/auth/login- Authenticate and get JWT token/api/test/**- Protected endpoints requiring authentication
This project uses:
- Spring Boot 3.4.5
- Spring Security
- Spring Data JPA
- MySQL Connector
- JJWT for JWT implementation
This project is licensed under the MIT License.