Skip to content

Authentication (auth module)

The auth module of Zelly's Nexus provides account registration, password login, automatic verified Bedrock and Mojang premium onboarding, pre-login quarantine, and optional two-factor security.

Pre-login gate

While enabled: true in modules/auth/config.yml (default):

  • Unauthenticated players are confined in an isolated void world (isolated-world.enabled: true, isolated-world.name: "nexus_auth") and receive configured security effects (blindness, slowness, invulnerability).
  • Movement, block breaking/placing, interaction, item drops/pickups, damage, and inventory clicks are blocked until authenticated; chat is blocked while security-effects.mute-chat: true (default).
  • By default, /zn, /zn menu, /zn help, /zn auth work before login alongside any entry in allowed-commands (multi-word commands supported). Inside /zn auth, only login, register, recovery reset, captcha, form, and menu are permitted pre-login.
  • Credentials passed to login, register, setpassword, changepassword, recovery, email, pin, totp, otp, and unregister under /zn auth are masked as *** in the server console log.
  • If the auth module fails to load on startup while enabled: true, every join is refused until the next restart restores it.

Verified Bedrock auto-account and notice

With auto-login-bedrock: true and auto-register-bedrock: true (both default true):

  1. First join through Floodgate: When Floodgate verifies the Bedrock player's session (FloodgateSupport.isFloodgateId / identify) and no Nexus account exists for that UUID, Nexus creates the account automatically tied to the Bedrock identity and marks it logged in.
  2. First-join notice: Immediately after auto-creating the Bedrock account, Nexus displays the localized first-join notice (auth.bedrock_auto_created in en and es) telling the player in plain words that an account was created automatically, tied to their Bedrock identity, and how to set an optional password (/zn auth setpassword <password> or /zn -> Account). The notice is sent on first join only.
  3. Subsequent joins: Existing Bedrock accounts log in automatically on subsequent joins without repeating the first-join notice.
  4. Linked Bedrock accounts: Follow bedrock.linked-accounts: true (default). When set to false, linked accounts fall back to the regular password flow.
  5. Offline impostor isolation and Floodgate absence: Accounts are keyed strictly by UUID string (AuthService.users). Offline Java clients using a Floodgate-style prefix such as .PlayerName receive an offline v3 UUID, fail Floodgate verification, fail Mojang premium verification, and stay isolated inside nexus_auth. When Floodgate is absent, Bedrock auto-login never runs. Note: unit and integration tests verify this flow cleanly; live Floodgate/Geyser join remains unverified until an owner playtest.
  6. Required Geyser and Floodgate prerequisites: auto-login-bedrock: true is safe only when Geyser authenticates Bedrock sessions through Xbox Live and Floodgate verifies them:
  7. Set auth-type: floodgate in Geyser config.yml (never offline).
  8. Copy the exact same Floodgate key.pem to Geyser (and across proxy and backend servers).
  9. On Velocity or BungeeCord proxies, set send-floodgate-data: true in Floodgate's proxy configuration so backend servers receive authenticated FloodgateApi sessions.
  10. Keep Floodgate's username-prefix (default .) consistent so offline Java accounts cannot collide with Bedrock usernames.
  11. Staff password requirement: With require-password-for-staff: true (default), operators (isOp()) and accounts holding zn.admin or zn.auth.admin are excluded from Bedrock and Mojang premium auto-login and must authenticate with a password.

Mojang premium auto-register

With auto-login-premium: true and auto-register-premium: true (both default true):

  • Online-mode servers, trusted proxies (premium.proxy-trust: true), and verified Mojang session lookups (premium.direct-verification: true, premium.fail-closed: true) automatically create an account on first join and log the player in, showing a first-join notice explaining how to set an optional password (/zn auth setpassword).
  • Unverified connections claiming a known Mojang premium username follow premium.name-protection: kick in default modules/auth/config.yml (internal fallback password if omitted). Live Mojang online-mode joins are only verifiable on an online-mode playtest server.
  • Note on premium.direct-verification: the shipped default remains true pending live Mojang online-mode playtest verification (playtest step 7 decides whether it stays enabled by default). Toggling this key requires a full server restart.

Player security features

Feature Command Summary
Register / Login /zn auth register <pw>, /zn auth login <pw> [totp] [pin] Password length min-password-length: 4 to max-password-length: 64, max failures 5, lockout 60s
Set / Change password /zn auth setpassword <pw>, /zn auth changepassword <old> <new> Sets a password on auto-created accounts or changes an existing password
Session memory /zn auth remember <on\|off> Remembers login sessions for session-hours: 12 by matching address
Recovery code /zn auth recovery generate, /zn auth recovery reset <code> <newPassword> Generates a one-time BCrypt-hashed recovery code and allows pre-login reset
Secondary PIN /zn auth pin set <pin>, /zn auth pin verify <pin>, /zn auth pin reset Optional numeric secondary authentication step
TOTP 2FA /zn auth totp setup, /zn auth totp confirm <code>, /zn auth totp disable Time-based one-time password authenticator flow
One-time code (OTP) /zn auth otp generate, /zn auth otp verify <code> Temporary code expiring after otp-expiry-seconds: 300
Recovery email /zn auth email add <email>, /zn auth email change <email>, /zn auth email recover ... Stores recovery contact and issues reset codes
Captcha / Verification /zn auth captcha [answer], /zn auth verification [code] Interactive verification challenge flows

Administration

Operators (zn.auth.admin) can run /zn auth delacc <player>, premium [player], cracked <player>, freemium <player>, getlogs <player>, admin reload, admin purge [days], and admin forcelogin <player>. All mode transitions write audit entries with the acting administrator and previous/new mode.