A comprehensive Spring Boot authentication service with JWT tokens, MFA support, email verification, and OAuth2 integration.
- Java 17+
- Maven 3.6+
-
Clone and setup
git clone https://github.com/sakhileln/authentication.git cd authentication -
Configure environment
export JWT_SECRET="your-super-secret-jwt-key-that-should-be-at-least-256-bits-long" export MAIL_USERNAME="your-email@gmail.com" export MAIL_PASSWORD="your-app-password"
-
Run the application
# Generate a test token make token # Export the token and test user endpoints export TOKEN=<token_from_above> make users # Setup and run make setup make dev-up # Clean up make dev-down make clean
-
Access the API
- Base URL:
http://localhost:8080 - Database:
authdb.sqlite(created automatically)
- Base URL:
- API Reference - Complete API documentation
- Architecture - System design and components
- Security - Security features and best practices
- Database - Database schema and management
- Deployment - Production deployment guide
- JWT Authentication with refresh tokens
- Email verification system
- Password reset and management
- Multi-Factor Authentication (TOTP)
- OAuth2 integration (Google, GitHub)
- SQLite3 database
- Token revocation and management
- Java 17 + Spring Boot 3.2.0
- Spring Security + JWT
- Spring Data JPA + SQLite3
- TOTP for MFA
- Spring Mail for email notifications
curl -X POST http://localhost:8080/auth/signup \
-H "Content-Type: application/json" \
-d '{
"username": "sakhile",
"email": "sakhile@mars.com",
"password": "SecurePass123!",
"confirmPassword": "SecurePass123!",
"firstName": "Sakhile",
"lastName": "Ndlazi"
}'curl -X POST http://localhost:8080/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "sakhile@mars.com",
"password": "SecurePass123!"
}'See API Reference for complete examples.
- BCrypt password hashing
- JWT with HMAC-SHA256 signing
- Configurable token expiration
- MFA with TOTP and backup codes
- Email verification required
- CORS configuration
This project is licensed under license.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
- Check the documentation
- Create an issue for bugs
- Suggest features via issues
- Sakhile III
- LinkedIn Profile
- GitHub Profile