This is a demonstration application for managing users and roles, handling authentication using Java 21, Spring Boot, Spring Security, and Java-Jwt. The application also includes an email notification service for login and password modification events.
- User Registration and Management
- Role-Based Access Control
- JWT-based Authentication
- Email Notifications for:
- Successful Logins
- Password Changes
- Java 21
- Spring Boot
- Spring Security
- Java-Jwt
- Spring Data JPA
- H2 Database (for development)
- Thymeleaf (for views)
- JavaMailSender (for email notifications)
- JDK 21 or later
- Maven 3.6+
- An email server or SMTP service (for email notifications)
-
Clone the repository
git clone https://github.com/your-username/user-management-demo.git cd user-management-demo
-
Configure application properties
Open
src/main/resources/application.properties
and set your email server configurations:spring.mail.host=smtp.example.com spring.mail.port=587 spring.mail.username=your-email@example.com spring.mail.password=your-email-password spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true jwt.secret=your-jwt-secret-key
-
Build and run the application
Use Maven to build and run the application:
mvn clean install mvn spring-boot:run
-
Access the application
Open your browser and navigate to
http://localhost:8888
.
- POST
/api/auth/login
- Authenticate a user and return a JWT - POST
/api/auth/register
- Register a new user
- GET
/api/users
- Get a list of all users (Admin only) - GET
/api/users/{id}
- Get details of a specific user - PUT
/api/users/{id}
- Update user information - DELETE
/api/users/{id}
- Delete a user
- GET
/api/roles
- Get a list of all roles (Admin only) - POST
/api/roles
- Create a new role (Admin only) - PUT
/api/roles/{id}
- Update role information (Admin only) - DELETE
/api/roles/{id}
- Delete a role (Admin only)
The application sends email notifications for the following events:
- Login - A notification is sent to the user's registered email after a successful login.
- Password Change - A notification is sent to the user's registered email after a password change.
This project is licensed under the MIT License. See the LICENSE file for details.
- Spring Boot Documentation
- Spring Security Documentation
- Java JWT Documentation
For any issues or questions, please open an issue on GitHub or contact the repository owner at brodymounanga@gmail.com