A professional-grade multi-threaded Java application featuring enterprise-level secure authentication with Role-Based Access Control (RBAC), comprehensive audit logging, advanced admin panel, and real-time notifications.
- ๐ Role-Based Access Control: Three role levels (ADMIN, MODERATOR, USER) with granular permission system
- ๐ Comprehensive Audit Logging: Track all operations with timestamps, user, IP, and status
- ๐จโ๐ผ Admin Panel: Manage users, assign roles, suspend/delete accounts, and view statistics
- ๐ Real-Time Notifications: Get alerts for role changes, account suspensions, and security events
- ๐ Dashboard Statistics: View user distribution, role breakdown, and login statistics
- ๐ฏ Command Autocomplete: Intelligent command completion for faster interaction
- ๐ค Audit Export: Export logs to CSV for external analysis
- ๐จ Dynamic Menus: Context-aware interface based on user role and authentication status
- Setup Database: Run
setup_db.batto initialize MySQL with RBAC schema - Run Application: Double-click
run_all.batto:- Compile both client and server automatically
- Start the Server in a separate window
- Launch the Client (login with test accounts below)
# Setup database (ensure MySQL is running)
mysql -u root -p < server/schema.sql
# Build project
mvn clean compile
# Terminal 1: Run Server
mvn -f server/pom.xml exec:java -Dexec.mainClass="com.example.server.Server"
# Terminal 2: Run Client
mvn -f client/pom.xml exec:java -Dexec.mainClass="com.example.client.Client"- ADMIN: Full system access, user management, audit logs, statistics
- MODERATOR: View users and logs, limited management capabilities
- USER: Standard access, manage own account only
- Track login/logout events
- Monitor password changes
- Log role assignments and user deletions
- Record permission denials
- Export complete audit trail as CSV
LIST_USERS List all users with roles and status
ASSIGN_ROLE <u> <role> Change user role (ADMIN/MODERATOR/USER)
SUSPEND_USER <user> Disable user account temporarily
DELETE_USER <user> Permanently remove user
VIEW_AUDIT <limit> Display recent audit log entries
EXPORT_AUDIT Export all logs to CSV file
DASHBOARD View system statistics and metrics
NOTIFICATIONS Check pending notifications
LOGIN <user> <pass> Authenticate to system
REGISTER <user> <pass> Create new account
STATUS Show session information
CHANGE_PASSWORD <old> <new> Update password
LOGOUT End current session
EXIT Close application
| Username | Password | Role | Capabilities |
|---|---|---|---|
admin |
password123 |
ADMIN | Full system access, user management |
moderator1 |
password123 |
MODERATOR | View users/logs, limited admin access |
user1 |
mypassword |
USER | Standard user, manage own account |
- Java 17+ (Microsoft OpenJDK 17.0.17.10 recommended)
- Maven 3.9.6+ (Must be in PATH)
- MySQL 8.0+ (Running on localhost:3306)
- JDBC Driver: Included in Maven dependencies
client-serveur/
โโโ client/ # Client application
โ โโโ src/main/java/.../ # Client source code
โโโ server/ # Server application
โ โโโ schema.sql # Database schema with RBAC
โ โโโ src/main/java/.../ # Server source code
โโโ pom.xml # Parent Maven configuration
โโโ run_all.bat # Windows automation script
โโโ setup_db.bat # Database setup script
โโโ README.md # This file
โโโ FEATURES_V3.md # Detailed feature documentation
Server.java- Accepts TCP connections on port 5000ClientHandler.java- Processes client requests with RBAC validationDatabaseConnection.java- MySQL connection poolingSecurityUtils.java- SHA-256 password hashingRole.java- Role and permission managementPermission.java- Fine-grained permission definitionsAuditLogger.java- Asynchronous audit trail loggingNotificationManager.java- Real-time notification system
- Dynamic menu system with role-based options
- Command autocomplete for faster interaction
- Interactive admin panel for privileged users
- Real-time response handling from server
- CSV export functionality for audit logs
users- User accounts with roles and activity trackingroles- Role definitions and descriptionsaudit_logs- Complete operation audit trail (indexed for performance)
- SHA-256 Password Hashing: All passwords are one-way hashed
- Permission Validation: Every command checked against user role
- IP Address Logging: All operations tracked with client IP
- Account Status Management: Suspend accounts without deletion
- Audit Trail: Complete history of all operations
- SQL Injection Prevention: PreparedStatements used throughout
- Session Management: Unique UUID for each connection
id INT PRIMARY KEY
username VARCHAR(50) UNIQUE
password VARCHAR(255) -- SHA-256 hash
role_id INT FOREIGN KEY to roles
is_active BOOLEAN -- Account suspension flag
created_at TIMESTAMP
last_login TIMESTAMPid INT PRIMARY KEY
role_name VARCHAR(50) UNIQUE
description VARCHAR(255)
created_at TIMESTAMPid INT PRIMARY KEY
user_id INT FOREIGN KEY to users
username VARCHAR(50)
action VARCHAR(100)
resource VARCHAR(100)
details VARCHAR(500)
ip_address VARCHAR(45)
status VARCHAR(20)
created_at TIMESTAMP (indexed)For comprehensive feature documentation, examples, troubleshooting, and best practices, see FEATURES_V3.md
Choice > 1 (or LOGIN)
Username: admin
Password: password123
>>> SUCCESS: Welcome admin [ADMIN]
Choice > 8 (or ADMIN)
Admin Choice > 1 (or LIST_USERS)
>>> ID | Username | Role | Active | Created | Last Login
Choice > 8 (or ADMIN)
Admin Choice > 6 (or EXPORT_AUDIT)
>>> [*] Audit logs exported to audit_export_1713698645000.csv
Choice > 8 (or ADMIN)
Admin Choice > 2 (or ASSIGN_ROLE)
Username: user1
Role: ADMIN
>>> SUCCESS: Role assigned
| Issue | Solution |
|---|---|
| "MySQL not found" | Install MySQL 8.0+ or verify path in setup_db.bat |
| "Maven not found" | Add Maven to system PATH or verify installation |
| "Permission denied" | Check your user role permissions with STATUS command |
| "Cannot delete admin" | Admin account cannot be deleted for security |
| "Audit logs not showing" | Ensure ADMIN or MODERATOR role |
- Connection Pooling: Optimized database connections
- Indexed Queries: Audit logs indexed by timestamp and user
- Async Logging: Non-blocking audit trail writes
- Thread Pool: Efficient multi-client handling
- Memory Management: Proper resource cleanup
If upgrading from v2.5:
- Run
setup_db.batto update database schema - Existing users assigned USER role by default
- Manually promote accounts to ADMIN/MODERATOR as needed
- Users must login again (old sessions invalidated)
This project is provided as-is for educational and professional use.
For feature requests, bug reports, or improvements:
- Test thoroughly in your environment
- Update documentation accordingly
- Push to GitHub with descriptive commit messages
Repository: https://github.com/Imposter-zx/Java-Client-Server-Application
Version: 3.0 | Last Updated: April 2026 | Status: Production Ready โ