服务器离线认证

服务器离线认证

为服务器上的离线玩家提供密码验证功能。

管理

ServerOfflineAuth

介绍


为服务器上的离线玩家提供密码认证。

特性

  • 内置加密数据存储
  • 支持 Json 和 MySQL
  • 令牌验证免密登录
  • 服务端令牌存储在 config/ 文件夹下的 server_offline_auth_tokens.json 文件中。

配置

ServerOfflineAuth 首次启动时,会在 config/ 目录下创建 server_offline_auth-common.toml 文件,内容如下:


#Server Offline Auth Configuration
[general]
    #Login timeout (seconds), set to 0 to disable
    #Range: 0 ~ 3600
    loginTimeout = 30
    #Salt length (log rounds). Default 10, range 4-30.
    #Range: 4 ~ 30
    passwordHashWorkFactor = 10
    #Player data file name (only effective when storage type is json)
    dataFileName = "server_offline_auth_data.json"
    #Whether to send a prompt when a player joins
    joinMessageEnabled = true

[storage]
    #Data storage type: json or mysql
    storageType = "json"
    #MySQL host address
    mysqlHost = "localhost"
    #MySQL port
    #Range: 1 ~ 65535
    mysqlPort = 3306
    #MySQL database name
    mysqlDatabase = "ServerOfflineAuth"
    #MySQL username
    mysqlUsername = "root"
    #MySQL password
    mysqlPassword = "password"
    #MySQL table name
    mysqlTable = "auth_players"
    #Token validity days (0 means never expires)
    #Range: 0 ~ 3650
    tokenExpiryDays = 3

[storage.migration]
    #Set this to perform data migration (e.g., "mysql" or "json"). After successful migration, this value will be automatically cleared, and storageType will be updated.
    migrateTo = ""
        
  • 如果数据存储模式为 JSON,将在服务器根目录下创建名为 server_offline_auth_data.json 的文件,用于存储玩家数据。
  • 如果数据存储模式为 MySQL,需要确保 MySQL 服务器已正确配置并运行,且提供的连接信息正确。

玩家命令

  • /register <passwd> <passwd> 注册
  • /login <passwd> 登录
  • /logout 登出

管理员命令

  • /serverofflineauth admin login <player_ID> 强制登录
  • /serverofflineauth admin logout <player_ID> 强制登出

要求


服务器要求

本模组基于 Minecraft Forge 1.20.1 开发;在其他版本上的有效性尚未验证。

注意事项


本模组处于早期测试阶段,更多功能正在开发中。请勿在重要环境中使用测试版本。

如果在使用过程中遇到 bug,请在 GitHub 上提交 issue。

贡献者


团队成员:ttwlwlbb51522, ChaosException, Archiveorigin