LibreLogin Documentation

repository·master·Indexed 42 days ago

https://github.com/kyngs/librelogin

An open-source, multiplatform authentication plugin for Velocity, BungeeCord, and Paper. Features include AutoLogin for premium players, TOTP 2FA, session management, and email-based password resets. Requires Java 17 or newer and supports Bedrock players via Floodgate.

Tokens
3.7K
Snippets
14
Records
21
Agent score
53%

What's inside LibreLogin

  1. Overview of LibreLogin features

    master

    LibreLogin (formerly LibrePremium) is an open-source, multiplatform authentication plugin designed for high customizability. Key features include:

    • AutoLogin: Automatically logs in premium players.
    • TOTP 2FA: Supports Time-based One-Time Passwords via apps like Authy or Google Authenticator.
    • Session System: Manages player sessions.
    • Name Validation: Includes case sensitivity checks.
    • Data Migration: Provides automatic migration for premium players and a single-command migration for player data.
    • Geyser/Bedrock Support: Compatible with Bedrock players via Floodgate.
  2. Requirements and security considerations for LibreLogin

    master

    Requirements

    • Java: Requires Java 17 or newer.

    Security Considerations

    • Proxy Usage: If you are running LibreLogin on a proxy (such as Velocity or BungeeCord), you must ensure your limbo server is properly secured.
  3. Command Throttling and Error Handling

    master

    LibreLogin implements rate limiting on commands to prevent abuse.

    • Throttling: Commands are subject to a rate limiter (defaulting to 1 attempt per second). If a user exceeds this, they will receive an error-throttle message.
    • Error Handling: The plugin uses a custom exception handler. If a command results in an InvalidCommandArgument exception, the plugin catches it and sends the specific error message (e.g., syntax errors or invalid arguments) directly to the user's audience. Unexpected exceptions are logged to the server console with a stack trace.
  4. Generate a System Diagnostic Dump

    master

    The /librelogin dump command creates a detailed JSON diagnostic file in the plugin's dumps/ folder. This file is useful for debugging and includes:

    • Plugin version and timestamp
    • Proxy data (plugin list, server list, limbo/lobby information)
    • A full thread dump including thread IDs, names, states, priorities, and stack traces.

    Files are named using the pattern dump-dd-MM-yyyy_HH-mm-ss.json.

    /librelogin dump
  5. Available LibreLogin Commands

    master

    LibreLogin provides a suite of commands for authentication, account management, and premium features. The availability of certain commands depends on your plugin configuration (e.g., whether an Email Handler or TOTP Provider is enabled).

    Core Commands

    • LoginCommand: For logging into an account.
    • RegisterCommand: For registering a new account.
    • ChangePasswordCommand: To change the current user's password.
    • LibreLoginCommand: General plugin management/staff commands.
    • PremiumEnableCommand / PremiumDisableCommand: To manage premium status.
    • PremiumConfirmCommand: To confirm a premium status change.

    Conditional Commands

    If a TOTP Provider is configured:

    • TwoFactorAuthCommand: To manage Two-Factor Authentication.
    • TwoFactorConfirmCommand: To confirm Two-Factor Authentication setup.

    If an Email Handler is configured:

    • SetEMailCommand: To set or update the account email.
    • VerifyEMailCommand: To verify a new email address.
    • ResetPasswordViaEMailCommand: To initiate a password reset via email.
    • ConfirmPasswordReset: To complete the password reset process.
  6. Confirm password reset via CLI

    master

    The confirmpasswordreset command allows a user to finalize a password reset process using a provided token and a new password. This command validates the token against the current password reset cache and ensures the new password matches the repetition input.

    Usage Syntax: confirmpasswordreset <token> <password> <passwordRepeat>

    Requirements for success:

    1. The <token> must match the token currently stored in the password reset cache for the user.
    2. The <password> and <passwordRepeat> arguments must be identical.

    Upon successful execution, the user's password is updated in the database, the reset cache is invalidated for that user, and a password change event is fired.

    confirmpasswordreset <token> <password> <passwordRepeat>
  7. System Administration Commands

    master

    Commands for managing the plugin's internal state and configuration.

    # Reload the main configuration file
    /librelogin reload configuration
    
    # Reload the messages/localization files
    /librelogin reload messages
    
    # Test the email handler by sending a test mail to an address
    /librelogin email test <email>
    
    # Get plugin version information
    /librelogin about
    
    # Generate a system diagnostic dump
    /librelogin dump
  8. Change password via CLI

    master

    Use the password change command to update a user's password. This command requires the current password and a new password. It validates the old password against the stored hash before updating the database and firing a password change event.

    Aliases:

    • changepassword
    • changepass
    • passwd
    • passch

    Syntax: {@@syntax.change-password} (Refer to your specific localization files for the exact string format, typically <old_password> <new_password>)

    Errors:

    • If the user is not registered, it returns the error: error-no-password.
    • If the old password does not match, it returns the error: error-password-wrong and fires an AuthenticWrongPasswordEvent with AuthenticationSource.CHANGE_PASSWORD.
  9. Manage User Accounts with /librelogin user

    master

    Use the user subcommand to perform various administrative tasks on player accounts. Note that many of these commands require the target user to be offline.

    # View detailed information about a user
    /librelogin user info <name>
    
    # Register a new cracked account
    /librelogin user register <name> <password>
    
    # Manually enable premium (Mojang) status for a user
    /librelogin user premium <name>
    
    # Disable premium status (switch to cracked)
    /librelogin user cracked <name>
    
    # Change a user's nickname/identity
    /librelogin user migrate <name> <new_name>
    
    # Delete a user account
    /librelogin user delete <name>
    
    # Unregister a user (clears password, 2FA, email, and premium status)
    /librelogin user unregister <name>
    
    # Force a user to log in (requires user to be online and unauthorized)
    /librelogin user login <name>
    
    # Manage user security and contact info
    /librelogin user 2faoff <name>          # Disable 2FA
    /librelogin user emailoff <name>        # Remove email
    /librelogin user setemail <name> <email> # Set email
    /librelogin user pass-change <name> <password> # Change password
    
    # View accounts sharing the same IP address
    /librelogin user alts <name>
  10. Confirm Two-Factor Authentication with /2faconfirm

    master

    Use the /2faconfirm <code >confirm command to complete the two-factor authentication (2FA) process. This command expects a numeric code (such as a TOTP code) as an argument. The command handles spaces within the code automatically by stripping them before parsing.

    Requirements:

    • The player must be currently in a state of awaiting 2FA verification.
    • The provided code must be a valid integer.

    If the confirmation is successful, the player will be kicked from the server with a message indicating that 2FA is enabled (typically used to force a re-login or to finalize the authentication state).

    /2faconfirm <code >confirm