a basic Java authentication system backed by MySQL. handles user registration, login, and session tokens.
- register users with bcrypt-hashed passwords
- login and get a session token (valid 7 days)
- validate a token to see who's logged in
- logout by deleting the token
- auto-cleans up expired sessions
- Java 23, Maven
- MySQL
- jBCrypt for password hashing
- JDBC for database access
- create the database using
schema.sql - update credentials in
Database.javato match your local MySQL setup - build with
mvn packageand runMain.java
runs as a CLI, just pick from the menu:
0) Exit
1) Register
2) Login
3) Who am I
4) Logout