A comprehensive console-based authentication system with role-based access control, built following MVC architecture principles.
Features • Installation • Usage • Architecture • Security
- 🚀 Features
- 🛠️ Recent Updates
- 🏗️ Architecture
- 📁 Project Structure
- 🛡️ Security Features
- 🎯 User Roles & Permissions
- ⚙️ Installation
- 🖥️ Usage
- 🧪 Testing
- 📝 API Documentation
- 🤝 Contributing
- 📄 License
- 🔧 Full professional deep corrections - Every file professionally corrected and enhanced
- 🎯 Advanced Notification System - Complete notification management with priorities and categories
- 🗄️ Professional Backup Management - Enterprise-grade backup and recovery operations
- 🏗️ Enhanced Architecture - Full MVC implementation with professional error handling
- � Complete Service Layer - NotificationService and BackupRecoveryService fully implemented
- 🔐 Robust Permission System - Role-based access control throughout all features
- 🧹 Zero Compilation Errors - Entire codebase compiles and runs flawlessly
- Complete notification management system with 6 main features
- Advanced filtering: View all, unread only, urgent notifications
- Administrative capabilities: Create and broadcast notifications
- Professional UI: Unread counters, priority indicators, notification aging
- Full integration: User permissions, notification archiving, cleanup utilities
- Notification types: Security alerts, login events, system maintenance, user changes
- Enterprise backup operations: Full, Incremental, Emergency backup types
- Advanced restore capabilities: Point-in-time recovery with safety confirmations
- Backup verification: Integrity checking and metadata validation
- Maintenance tools: Expired backup cleanup, specific deletion capabilities
- Professional interface: Progress tracking, detailed status reporting
- Async operations: CompletableFuture-based operations with timeout handling
- Advanced metadata tracking: Encryption, compression, retention policies
- Status management: Complete backup lifecycle tracking
- Professional display: Formatted file sizes, duration calculations
- Quality improvements: Switch expressions, final fields, proper annotations
- Complete user management: Profile viewing, password changes, statistics
- Administrative features: User creation, deletion, role management
- Professional error handling: Comprehensive validation and feedback
- Security integration: Permission checks throughout all operations
- ✅ Secure user registration with data validation
- ✅ User login/logout with session management
- ✅ Role-Based Access Control (RBAC)
- ✅ Account lockout protection after failed attempts
- ✅ Password strength validation
- ✅ Comprehensive user profile management
- ✅ User search and filtering capabilities
- ✅ Account activation/deactivation
- ✅ Role assignment and modification
- ✅ User deletion with confirmation
- ✅ Multi-priority notification management (Low, Medium, High, Critical)
- ✅ Comprehensive notification types (Security, Login, System, Maintenance)
- ✅ Unread notification tracking with counters and aging
- ✅ Administrative notification creation and broadcasting
- ✅ Notification archiving and cleanup utilities
- ✅ Urgent notification alerts and real-time status display
- ✅ Multiple backup types (Full, Incremental, Emergency)
- ✅ Advanced backup metadata with encryption and compression
- ✅ Point-in-time system restore with safety confirmations
- ✅ Backup integrity verification and status monitoring
- ✅ Automated backup cleanup and retention management
- ✅ Async backup operations with progress tracking
- ✅ Real-time system statistics and health monitoring
- ✅ Audit logging and security reports
- ✅ Login history tracking and user analytics
- ✅ Backup system status and management
- ✅ Notification system statistics and cleanup
- ✅ Input validation and sanitization
- ✅ Failed login attempt tracking
- ✅ Account lockout mechanisms
- ✅ Permission-based access control
- ✅ Secure password handling
This project follows the MVC (Model-View-Controller) design pattern with clear separation of concerns:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ VIEW │◄──►│ CONTROLLER │◄──►│ MODEL │
│ │ │ │ │ │
│ • ConsoleView │ │ • AuthController│ │ • User │
│ • User Interface│ │ • Business Logic│ │ • UserDatabase │
│ • Input/Output │ │ • Flow Control │ │ • Data Storage │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ SERVICES │
│ │
│ • PermissionSvc │
│ • Security Logic│
└─────────────────┘
java-login-system/
├── 📁 src/main/java/com/loginapp/
│ ├── 📄 Main.java # Application entry point
│ ├── 📁 controller/
│ │ └── 📄 AuthController.java # Main application controller
│ ├── 📁 model/
│ │ ├── 📄 User.java # User entity model
│ │ ├── 📄 UserDatabase.java # Data access layer
│ │ ├── 📄 Role.java # Role enumeration
│ │ └── 📄 RegistrationResult.java # Registration response model
│ ├── 📁 services/
│ │ └── 📄 PermissionService.java # Authorization service
│ └── 📁 view/
│ └── 📄 ConsoleView.java # User interface layer
├── 📄 README.md # Project documentation
└── 📄 .gitignore # Git ignore file
- Failed Login Protection: Automatic account lockout after 5 failed attempts
- Password Validation: Enforced minimum 6 characters, maximum 50 characters
- Input Sanitization: All user inputs are validated and sanitized
- Session Management: Secure session handling with proper logout
- Login History: Complete tracking of login attempts and sessions
- Audit Trail: Comprehensive logging of all system operations
- Security Reports: Real-time security status and threat detection
| Role | Permissions | Description |
|---|---|---|
| 🔴 Admin | Full System Access | • Manage all users and roles • Access system administration • View audit logs and reports • System configuration |
| 🟡 Moderator | User Management | • Manage regular users • Content moderation • View user statistics • Limited admin functions |
| 🟢 User | Basic Access | • Manage own profile • Change password • View public statistics • Basic system usage |
| Username | Password | Role | Purpose |
|---|---|---|---|
admin |
admin123 |
Administrator | Full system testing |
moderator |
mod123 |
Moderator | User management testing |
testuser |
password123 |
User | Basic functionality testing |
⚠️ Security Note: Change default passwords in production environments!
- ☕ Java 17 or higher
- 🔧 Git (for cloning)
- 💻 Terminal/Command Prompt
- Clone the repository
git clone https://github.com/teusdrz/java-login-system.git
cd java-login-system- Compile the project
javac -d out -cp src src/main/java/com/loginapp/**/*.java- Run the application
java -cp out com.loginapp.Maindocker build -t java-login-system .
docker run -it java-login-system================================
MAIN MENU
================================
1. Login
2. Register
3. View Public Statistics
4. Exit
================================
After successful login, users see role-specific options:
================================
USER DASHBOARD
================================
Welcome, [User Name]!
Role: [User Role]
Email: [User Email]
Account Status: [Active/Locked]
PROFILE OPTIONS:
1. View Profile Details
2. Edit Profile
3. Change Password
[Role-specific options appear here]
0. Logout
================================
Administrators have access to advanced features:
- 👥 User Management: Create, modify, delete users
- 📊 System Statistics: View comprehensive system metrics
- 🔍 Audit Logs: Review security and system events
- ⚙️ System Health: Monitor application performance
-
Authentication Testing
- Valid/invalid login attempts
- Account lockout scenarios
- Password validation
-
Authorization Testing
- Role-based access verification
- Permission boundary testing
- Privilege escalation prevention
-
Data Validation Testing
- Input sanitization
- Email format validation
- Username requirements
# Compile and run basic functionality test
java -cp out com.loginapp.Main
# Test with default accounts
# Username: admin, Password: admin123
# Username: moderator, Password: mod123
# Username: testuser, Password: password123Main application controller handling user interactions and business logic.
public class AuthController {
public void startApplication() // Main application loop
private void handleLogin() // User authentication
private void handleRegistration() // User registration
private void handleUserManagement() // Admin user management
// ... additional methods
}User entity with comprehensive validation and role management.
public class User {
// Core properties
private String username, password, email;
private String firstName, lastName;
private Role role;
private boolean isActive, isLocked;
// Validation methods
public boolean isValidUsername()
public boolean isValidPassword()
public boolean isValidEmail()
// ... additional methods
}Centralized authorization and permission management.
public class PermissionService {
public boolean hasPermission(User user, String permission)
public boolean canManageUser(User manager, User target)
public boolean canChangeUserRole(User changer, User target, Role newRole)
// ... additional methods
}- 🗄️ Database Integration (MySQL/PostgreSQL)
- 🌐 Web Interface (Spring Boot)
- 🔐 JWT Authentication
- 📧 Email Verification
- 🔑 Two-Factor Authentication (2FA)
- 📱 Mobile App Support
- 🐳 Docker Containerization
- ☁️ Cloud Deployment (AWS/Azure)
- ✅ v1.2.0 - Enhanced role-based access control
- ✅ v1.1.0 - Added audit logging and security reports
- ✅ v1.0.0 - Initial release with basic authentication
We welcome contributions! Please follow these steps:
- 🍴 Fork the repository
- 🌿 Create a feature branch (
git checkout -b feature/amazing-feature) - 💾 Commit your changes (
git commit -m 'Add amazing feature') - 📤 Push to the branch (
git push origin feature/amazing-feature) - 🔄 Open a Pull Request
- Follow Java coding conventions
- Add unit tests for new features
- Update documentation as needed
- Ensure backward compatibility
Found a bug? Please create an issue with:
- 🔍 Clear description of the problem
- 📝 Steps to reproduce the issue
- 💻 Environment details (Java version, OS)
- 📸 Screenshots if applicable
This project is licensed under the MIT License - see the LICENSE file for details.
Matheus Vinicius dos Reis Souza
- GitHub: @teusdrz
- Project: java-login-system
- ☕ Built with Java
- 🏗️ MVC Architecture Pattern
- 🛡️ Security Best Practices
- 📚 Educational Purpose
⭐ Star this repository if you found it helpful!
Made with ❤️ by Matheus Vinicius