A Minecraft Fabric mod that provides player authentication functionality for servers.
Authenticate is a server-side authentication mod for Minecraft that allows players to register accounts with passwords and login to access the server. This mod helps protect your server from unauthorized access and provides basic account management features.
- Player Registration: Players can register accounts with passwords
- Player Login: Secure login system with password verification
- Player Logout: Players can logout from their accounts
- Ban System: Server administrators can ban players
- Database Storage: Uses H2 database for persistent data storage
- Cross-version Support: Supports multiple Minecraft versions
- Fabric Language Kotlin: Required for Kotlin support
- Fabric ORM Jimmer: Required for database operations
- Fabric Database H2: For H2 database support
/register <password> <confirm>
- Register a new account/login <password>
- Login to your account/logout
- Logout from your account/auth ban <player> <unit> <amount>
- Ban a player (admin only)
- When a new player joins the server, they will be prompted to register
- Use
/register <password> <confirm>
to create an account - Make sure both passwords match
- After successful registration, you can login with
/login <password>
- Use
/login <password>
to access your account - You must be logged in to interact with the server
- Use
/logout
when you're done playing
The mod creates configuration files in the config
folder:
Authenticate.json
- Main configuration file
The configuration file is automatically created at:
./config/Authenticate.json
The Authenticate.json
file contains the following configuration options:
- Default:
"en_us"
- Description: Sets the language for the mod's messages
- Available Options:
"en_us"
- English"zh_cn"
- Chinese (Simplified)
- Default:
"jdbc:h2:file:./db/authenticate"
- Description: The JDBC connection URL for the database
- Notes:
- Uses H2 database by default
- Database file is stored in
./db/authenticate.mv.db
- You can change this to use other databases (MySQL, PostgreSQL, etc.)
- Default:
null
- Description: Database username (if required)
- Notes: Leave as
null
for H2 database (no authentication required)
- Default:
null
- Description: Database password (if required)
- Notes: Leave as
null
for H2 database (no authentication required)
- Default: Auto-generated Base64 encoded UUID
- Description: Salt used for password hashing
- Notes:
- Automatically generated on first run
- Do not change this value after players have registered
- Changing the salt will invalidate all existing passwords
- Default: SQL DDL for creating the player table
- Description: SQL statement to create the database table
- Notes:
- Only modify if you understand database schema design
{
"lang": "en_us",
"jdbcUrl": "jdbc:h2:file:./db/authenticate",
"username": null,
"password": null,
"salt": "YXV0aGVudGljYXRlLXNhbHQ=",
"ddlStatement": "create table if not exists player_v0 (id uuid primary key not null, created_time timestamp not null, modified_time timestamp not null, uuid uuid unique not null, password varchar(255) not null, banned timestamp);"
}
The mod supports multiple database systems for storing player authentication data. The database connection is configured
through the jdbcUrl
parameter in the configuration file.
- Driver: Built-in H2 driver
- Default URL:
jdbc:h2:file:./db/authenticate
- File Location:
./db/authenticate.mv.db
- Pros:
- No additional setup required
- File-based, portable
- Good for small to medium servers
- Cons:
- Limited concurrent connections
- Not suitable for large-scale deployments
- Driver: MySQL Connector/J
- URL Format:
jdbc:mysql://hostname:port/database_name
- Example:
jdbc:mysql://localhost:3306/authenticate
- Pros:
- High performance
- Excellent for large servers
- Robust and reliable
- Cons:
- Requires separate MySQL server setup
- Additional dependency needed
- Driver: PostgreSQL JDBC Driver
- URL Format:
jdbc:postgresql://hostname:port/database_name
- Example:
jdbc:postgresql://localhost:5432/authenticate
- Pros:
- ACID compliant
- Excellent data integrity
- Advanced features
- Cons:
- Requires separate PostgreSQL server
- More complex setup
- Driver: Oracle JDBC Driver
- URL Format:
jdbc:oracle:thin:@hostname:port:service_name
- Example:
jdbc:oracle:thin:@localhost:1521:XE
- Pros:
- Enterprise-grade reliability
- Advanced features
- Excellent for large enterprises
- Cons:
- Complex licensing
- Resource intensive
- Requires Oracle server setup
- Driver: SQLite JDBC Driver
- URL Format:
jdbc:sqlite:file_path
- Example:
jdbc:sqlite:./db/authenticate.db
- Pros:
- Lightweight and portable
- No server setup required
- Good for small servers
- Cons:
- Limited concurrent access
- Not suitable for high-traffic servers
{
"jdbcUrl": "jdbc:h2:file:./db/authenticate",
"username": null,
"password": null
}
{
"jdbcUrl": "jdbc:mysql://localhost:3306/authenticate?useSSL=false&serverTimezone=UTC",
"username": "authenticate_user",
"password": "your_password"
}
{
"jdbcUrl": "jdbc:postgresql://localhost:5432/authenticate",
"username": "authenticate_user",
"password": "your_password"
}
{
"jdbcUrl": "jdbc:oracle:thin:@localhost:1521:XE",
"username": "authenticate_user",
"password": "your_password"
}
{
"jdbcUrl": "jdbc:sqlite:./db/authenticate.db",
"username": null,
"password": null
}
- Install MySQL Server
- Create database:
CREATE DATABASE authenticate;
- Create user:
CREATE USER 'authenticate_user'@'localhost' IDENTIFIED BY 'password';
- Grant permissions:
GRANT ALL PRIVILEGES ON authenticate.* TO 'authenticate_user'@'localhost';
- Add MySQL Connector/J to your mod dependencies
- Install PostgreSQL Server
- Create database:
CREATE DATABASE authenticate;
- Create user:
CREATE USER authenticate_user WITH PASSWORD 'password';
- Grant permissions:
GRANT ALL PRIVILEGES ON DATABASE authenticate TO authenticate_user;
- Add PostgreSQL JDBC Driver to your mod dependencies
- Install Oracle Database
- Create tablespace and user
- Grant necessary permissions
- Add Oracle JDBC Driver to your mod dependencies
- No additional setup required
- Add SQLite JDBC Driver to your mod dependencies
When switching between database systems:
- Backup your existing data
- Update the
jdbcUrl
,username
, andpassword
in configuration - Restart the server
- The mod will automatically create the required table structure
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues, please report them on the GitHub Issues page.