This project is a secure and scalable Spring Boot backend application developed as part of a backend domain challenge.
It implements:
- JWT-based Authentication
- Role-Based Access Control (RBAC)
- Secure Password Management
- RESTful API Design
- MySQL Database Integration
The application follows clean architecture principles and industry-standard security practices.
- Java
- Spring Boot
- Spring Security
- JWT (JSON Web Token)
- Spring Data JPA
- MySQL
- Maven
- User Registration (Signup)
- User Login
- JWT Token Generation
- Secure Password Hashing using BCrypt
- Role-Based Access Control
- Admin-Only Endpoints
- Secured APIs using Spring Security
- Create New Roles
- Assign Roles to Users
- Many-to-Many User ↔ Role Mapping
- Change Password
- Reset Password
- View Logged-in User Details
- Profile Management Support
- id
- email (unique)
- password
- status
- id
- name (ROLE_USER, ROLE_ADMIN)
- user_id
- role_id
-
User logs in using
/auth/login -
Server returns a JWT token
-
Client sends token in request header:
Authorization: Bearer <JWT_TOKEN>
-
Spring Security validates token via
JwtAuthenticationFilter -
Access is granted based on user roles
- POST /signup
- POST /auth/login
- POST /auth/reset-password
- GET /users/me
- POST /users/change-password
- POST /roles?name=ROLE_ADMIN
- POST /roles/assign?userId=1&role=ROLE_ADMIN
- GET /roles
git clone ...
cd your-repository
Update application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/your_database spring.datasource.username=your_username spring.datasource.password=your_password
mvn spring-boot:run
APIs can be tested using:
- Postman
- cURL
- Any REST client
POST /auth/login
{ "email": "user@example.com ", "password": "password123" }
src/main/java/com/example/demo │ ├── config ├── controller ├── service ├── repository ├── entity └── security
- Stateless Authentication
- Password Encryption with BCrypt
- Custom JWT Filter
- Role-Based Endpoint Protection
- Clean Separation of Concerns
- Refresh Token Implementation
- Email Verification
- Swagger API Documentation
- Unit & Integration Testing
- Docker Support
- Pagination & Sorting
Devagya Singh Vats