A robust authentication microservice built with Spring Boot that provides secure user registration, email verification, and login functionality.
This microservice follows a layered architecture pattern:
- Presentation Layer: Thymeleaf templates for web interface
- Service Layer: Business logic implementation
- Repository Layer: Data access and persistence
- Security Layer: Spring Security for authentication and authorization
- User registration with email verification
- Secure login with Spring Security
- Email notifications using MailDev for development
- PostgreSQL database integration
- Responsive web interface using Bootstrap
- Protected dashboard for authenticated users
- Backend Framework: Spring Boot 6.2.6
- Security: Spring Security 6.4.5
- Database: PostgreSQL
- Template Engine: Thymeleaf 3.1.3
- Email Testing: MailDev
- Frontend: Bootstrap 5.3.0
- Build Tool: Maven
- Java 17 or higher
- PostgreSQL 12 or higher
- Maven 3.6 or higher
- Node.js (for MailDev)
- Clone the repository:
git clone https://github.com/JoTsav/IDDSI.git
cd IDDSI-
Configure PostgreSQL:
- Create a new database named
IDDSI-registration - Update
application.ymlwith your database credentials
- Create a new database named
-
Install MailDev:
npm install -g maildev- Build the application:
mvn clean installUpdate src/main/resources/application.yml with your settings:
server:
port: 8081
error:
include-message: always
include-binding-errors: always
spring:
datasource:
password: your_password
url: jdbc:postgresql://localhost:5432/IDDSI-registration
username: your_username
driver-class-name: org.postgresql.Driver
jpa:
hibernate:
ddl-auto: create-drop # don't persist data
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
show-sql: true
mail:
host: localhost
port: 1025
username: hey
password: hey
properties:
mail:
smtp:
ssl:
trust: "*"
auth: true
starttls:
enable: true
connection timeout: 5000
timeout: 3000
write timeout: 5000- Start MailDev:
maildev- Run the Spring Boot application:
mvn spring-boot:runThe application will be available at:
- Main application: http://localhost:8081
- MailDev interface: http://localhost:1080
If you don't have Java or PostgreSQL installed locally, you can run the application using Docker:
-
Make sure you have Docker and Docker Compose installed on your system
-
Build the application:
mvn clean package -DskipTests- Start the containers:
docker-compose up --buildThe application will be available at:
- Main application: http://localhost:8081
- MailDev interface: http://localhost:1080
- PostgreSQL database: localhost:5432
To stop the application:
docker-compose downTo stop the application and remove the database volume:
docker-compose down -v-
Home Page (Port 8081)
-
Registration
-
Email Verification
-
Login
-
Dashboard
- Password encryption using BCrypt
- CSRF protection
- Session management
- Email verification for new registrations
- Protected routes and resources
POST /api/v1/registration- Register new userGET /api/v1/registration/confirm- Confirm email tokenPOST /login- User authenticationPOST /logout- User logoutGET /dashboard- Protected dashboard (requires authentication)
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- MailDev for email testing capabilities
- Spring Boot team for the excellent framework
- Bootstrap team for the responsive UI components
- Jo Tsav - GitHub Profile
This project is licensed under the MIT License - see the LICENSE file for details.