New YT

MASTER SOFTWARE ENGINEERING PROMPT

PROJECT LUNARLOGIN — ADVANCED MINECRAFT AUTHENTICATION & ACCOUNT SECURITY

  1. ROLE AND RESPONSIBILITY

Act as a Principal Software Architect, Senior Java Developer, Minecraft Paper API Specialist, Application Security Engineer, and Cryptography Engineer.

Your assignment is to design, engineer, test, and deliver LunarLogin, a high-security Minecraft authentication plugin.

Do not approach this project as a basic "/login" and "/register" plugin.

Treat it as a dedicated identity-management and account-protection system.

All design and implementation decisions must prioritize:

  1. Account ownership verification.
  2. Prevention of identity impersonation.
  3. Authentication integrity.
  4. Session security.
  5. Credential protection.
  6. Exploit prevention.
  7. Server performance and reliability.

Convenience is secondary to security.

---

  1. PROJECT SPECIFICATIONS

Property| Requirement Product| LunarLogin Platform| Minecraft Java Edition Server software| Paper Minecraft version| 1.21.11 Java version| 21 Language| Java Build system| Gradle Plugin architecture| Standalone Paper plugin Account support| Premium and Cracked Proxy dependency| None Default session duration| 10 minutes Default database| SQLite Optional database| MySQL Security philosophy| Zero Trust

The plugin must not depend on BungeeCord, Waterfall, Velocity, or another Minecraft proxy.

Use supported Paper APIs wherever possible. Avoid unnecessary NMS and internal server modifications.

---

  1. NON-NEGOTIABLE SECURITY ARCHITECTURE

Before writing code, perform a technical feasibility assessment.

The following requirements must be understood:

  • Supporting cracked accounts requires an offline-mode connection path.
  • Offline-mode connections do not establish native Microsoft account ownership.
  • Username and UUID matching cannot prove account ownership.
  • Vanilla offline-mode connections do not provide the normal online-mode authentication and transport encryption guarantees.

Therefore, do not implement fake Premium detection.

Premium authentication architecture

Implement a legitimate Microsoft account verification workflow using documented and currently authorized authentication mechanisms.

The verification chain must validate:

  1. Microsoft account authentication.
  2. Xbox Live authentication.
  3. XSTS authorization where required.
  4. Minecraft Java profile identity.
  5. Minecraft Java entitlement.
  6. Canonical Minecraft profile UUID.

For the standalone no-proxy configuration, implement a connection-bound external verification challenge.

Requirements:

  • Generate a cryptographically random, single-use verification challenge.
  • Associate it with the exact pending Minecraft connection.
  • Provide an HTTPS or supported Microsoft device-code verification flow.
  • Validate the authenticated Minecraft profile against the claimed account.
  • Automatically authenticate the corresponding pending Minecraft connection after successful verification.
  • Expire challenges after a configurable period.
  • Prevent challenge replay.
  • Never request a Microsoft password inside Minecraft.
  • Never store Microsoft passwords.
  • Never trust a browser response without cryptographic validation.

Premium players must not need "/LunarLogin" or "/LunarRegister".

Important limitation: With no proxy and cracked support, completely silent Premium authentication based only on the vanilla client's Microsoft launcher session is not possible. A browser/device approval or another independently authenticated mechanism is necessary. Do not pretend otherwise.

Cracked authentication architecture

Support password-based registration and authentication.

However, standard offline-mode Minecraft traffic is not encrypted. Consequently, the requested plaintext password command must not be represented as maximum-security authentication.

Hardened production mode must use a secure HTTPS credential flow or a proven encrypted client transport. Support the requested command syntax as a compatibility feature only when its transport security has been established and explicitly enabled by the administrator.

Never silently expose player passwords over an unencrypted connection.

---

  1. ACCOUNT REGISTRATION AND LOGIN

Required player-facing commands:

Registration

"/LunarRegister <password> <confirmPassword>"

Example:

"/LunarRegister StrongPass123 StrongPass123"

Login

"/LunarLogin <password>"

Example:

"/LunarLogin StrongPass123"

Functional requirements:

  • Validate password confirmation.
  • Enforce configurable password strength.
  • Prevent duplicate accounts.
  • Prevent premium identity impersonation.
  • Use Argon2id for password hashing.
  • Generate a unique random salt per account.
  • Store no plaintext passwords.
  • Never expose password hashes.
  • Prevent account enumeration.
  • Prevent brute-force attacks.
  • Implement progressive rate limiting.
  • Support secure password changes and account recovery.

A failed authentication must never grant access.

Use a random internal account identifier instead of treating an offline-mode UUID as an authenticated identity.

---

  1. PREMIUM IDENTITY PROTECTION

Create a dedicated PremiumIdentityService.

Responsibilities:

  • Maintain verified Microsoft/Minecraft identity records.
  • Associate verified Minecraft UUIDs with account records.
  • Validate profile ownership.
  • Protect registered Premium usernames.
  • Detect attempted Premium identity impersonation.
  • Prevent unauthorized account linking.
  • Handle legitimate Minecraft username changes.
  • Maintain an auditable identity-linking history.

A cracked player must never be permitted to register or log in under an already reserved Premium identity.

Public profile lookups may help detect name conflicts, but must never be accepted as proof of ownership.

Identity linking must be atomic and independently verified.

---

  1. SESSION MANAGEMENT ENGINE

Create a dedicated SessionManager.

Default configuration:

"session-duration: 10m"

The requested 10-minute session should remain valid for the defined post-hub grace period.

Implement:

  • Secure session creation.
  • Session expiration.
  • Session revocation.
  • Single-use authentication challenges.
  • Concurrent session policies.
  • Session activity tracking.
  • Forced administrator logout.
  • Password-change invalidation.
  • Suspicious-session invalidation.
  • Server shutdown handling.

Never use these as the sole proof of identity:

  • IP address.
  • Username.
  • Offline UUID.
  • Device location.
  • Connection timestamp.

Do not allow reconnecting to grant authentication automatically.

Persistent session resumption must require an independently authenticated secret or proof.

A stolen session identifier must not grant access to another connection.

---

  1. PRE-AUTHENTICATION SECURITY FIREWALL

Create an AuthenticationGuard responsible for every unauthenticated player.

Until authentication succeeds, deny:

  • Movement.
  • Block interaction.
  • Block placement.
  • Block breaking.
  • Inventory access.
  • Item dropping.
  • Item pickup.
  • PvP.
  • PvE attacks.
  • Entity interaction.
  • Teleportation.
  • Vehicle interaction.
  • Chat messages.
  • Protected commands.
  • Economy interactions.
  • Other configured plugin features.

Permit only authentication-related functionality.

Enforce restrictions server-side.

Do not rely on hiding buttons, titles, or inventory screens as a security mechanism.

Provide an integration API for other plugins to check authentication state before executing protected actions.

---

  1. ADVANCED ATTACK DEFENSE

Design the security subsystem against the following threats:

Identity attacks

  • Username spoofing.
  • UUID impersonation.
  • Premium account impersonation.
  • Unauthorized identity linking.
  • Duplicate identity creation.

Authentication attacks

  • Password brute force.
  • Credential stuffing.
  • Replay attacks.
  • Session hijacking.
  • Session fixation.
  • Authentication race conditions.
  • Concurrent login abuse.

Application attacks

  • SQL injection.
  • Malformed input.
  • Invalid command arguments.
  • Database corruption.
  • Unauthorized command execution.
  • Plugin interaction bypasses.

Availability attacks

  • Login flooding.
  • Excessive verification requests.
  • Connection spam.
  • Database exhaustion.
  • Repeated authentication failures.

Use layered defenses, bounded queues, rate limits, strict validation, and fail-closed behavior.

Do not promise protection against every network-level DDoS attack. Document the server infrastructure security requirements separately.

---

  1. CRYPTOGRAPHY AND DATA PROTECTION

Use established cryptographic libraries and maintained algorithms.

Mandatory requirements:

  • Argon2id for password hashing.
  • Secure random number generation.
  • Cryptographically strong nonces.
  • Unique challenge identifiers.
  • Constant-time comparison for secret verification.
  • TLS certificate validation for external HTTPS requests.
  • No hardcoded API secrets.
  • No plaintext credential storage.
  • No password or token logging.
  • Secure database access.

For MySQL:

  • Require TLS.
  • Verify certificates.
  • Use parameterized queries.
  • Follow least-privilege database permissions.

For SQLite:

  • Protect database file permissions.
  • Use transactions.
  • Handle concurrent access safely.
  • Provide secure backup and recovery procedures.

Never store raw session secrets or unnecessarily persistent Microsoft authentication tokens.

---

  1. DATABASE ARCHITECTURE

Create a modular persistence layer.

Suggested tables:

accounts

  • Internal account ID.
  • Normalized username.
  • Account type.
  • Password hash.
  • Registration timestamp.
  • Account status.

premium_identities

  • Verified Minecraft UUID.
  • Linked internal account ID.
  • Verified profile information.
  • Verification timestamp.
  • Identity status.

authentication_events

  • Event ID.
  • Account identifier.
  • Event type.
  • Timestamp.
  • Result.
  • Security metadata.

security_records

  • Failed attempt information.
  • Rate-limit state.
  • Lockout state.
  • Suspicious activity indicators.

session_records

  • Session ID.
  • Account ID.
  • Session state.
  • Creation time.
  • Expiration time.
  • Revocation information.

Do not store unnecessary personal information.

Implement database versioning, migrations, backups, and consistency checks.

---

  1. SECURITY ADMINISTRATION

Required commands:

"/LunarLogin reload"

"/LunarLogin info <player>"

"/LunarLogin logout <player>"

"/LunarLogin unregister <player>"

"/LunarLogin session <player>"

Permissions:

  • "lunarlogin.admin"
  • "lunarlogin.login"
  • "lunarlogin.register"
  • "lunarlogin.bypass"

Administrative security rules:

  • Never grant authentication bypass automatically to every operator.
  • Protect sensitive commands.
  • Require explicit bypass permissions.
  • Record administrator actions.
  • Prevent unauthenticated players from accessing privileged functionality.
  • Never reveal password hashes or session secrets.

Console administration should be supported.

---

  1. SECURITY MONITORING

Create a dedicated LunarLogin SecurityMonitor.

Monitor:

  • Failed authentication attempts.
  • Suspicious login patterns.
  • Account impersonation attempts.
  • Microsoft verification failures.
  • Unauthorized account linking.
  • Challenge expiration.
  • Session replay attempts.
  • Repeated authentication failures.
  • Administrator activity.
  • Database security errors.

Use configurable alert thresholds.

Provide readable security reports.

Ensure security logs never contain passwords, authentication tokens, or other secrets.

---

  1. CONFIGURATION ENGINE

Provide professional, modular configuration files.

Suggested structure:

"config.yml" "messages.yml" "database.yml" "security.yml" "premium.yml" "sessions.yml"

Example:

general: plugin-name: LunarLogin debug: false

accounts: premium: enabled: true automatic-verification: true

cracked: enabled: true registration-required: true

security: fail-closed: true prevent-identity-spoofing: true prevent-session-replay: true maximum-login-attempts: 5 authentication-timeout: 120

password: algorithm: ARGON2ID minimum-length: 12

transport: require-secure-credential-channel: true allow-plaintext-command-passwords: false

sessions: duration: 10m post-hub-grace-period: 10m survive-disconnect: false invalidate-on-password-change: true

database: type: SQLITE auto-save: true

All values must be validated.

Invalid or dangerous configurations must prevent the plugin from entering an insecure operating state.

---

  1. SOFTWARE ARCHITECTURE

Use separation of concerns and dependency injection where appropriate.

Suggested package structure:

com.lunarlogin │ ├── LunarLogin.java │ ├── authentication │ ├── AuthenticationManager.java │ ├── PremiumIdentityService.java │ ├── CrackedAuthenticationService.java │ └── AuthenticationState.java │ ├── security │ ├── SecurityManager.java │ ├── PasswordHasher.java │ ├── RateLimiter.java │ ├── ChallengeManager.java │ └── SecurityMonitor.java │ ├── session │ ├── SessionManager.java │ ├── Session.java │ └── SessionValidator.java │ ├── database │ ├── DatabaseManager.java │ ├── SQLiteProvider.java │ ├── MySQLProvider.java │ └── DatabaseMigration.java │ ├── listeners │ ├── ConnectionListener.java │ ├── AuthenticationListener.java │ ├── MovementListener.java │ └── ProtectionListener.java │ ├── commands │ ├── LoginCommand.java │ ├── RegisterCommand.java │ └── AdminCommand.java │ ├── configuration │ └── ConfigurationManager.java │ └── utilities ├── MessageManager.java └── ValidationUtils.java

Keep all database and external network operations off the main server thread.

Use safe synchronization when modifying player authentication state.

Do not introduce unsafe asynchronous Bukkit API calls.

---

  1. MANDATORY SECURITY TESTING

Create an automated test suite.

The following must pass before production release:

Test| Expected result Player A claims Player B's username| Denied Fake Premium identity| Denied UUID spoofing| Denied Invalid Microsoft verification| Denied Reused challenge| Denied Expired challenge| Denied Incorrect password| Denied Brute-force attack| Rate-limited SQL injection attempt| Rejected Session replay| Denied Unauthorized account linking| Denied Reconnect without proof| Denied Unauthenticated command execution| Blocked Database unavailable| Fail closed Server restart| No accidental authentication Plugin reload| No authentication bypass Password change| Old sessions revoked Concurrent login race| Correctly controlled

Additionally:

  • Perform threat modeling.
  • Perform security regression testing.
  • Test on a real Paper 1.21.11 server.
  • Test compatibility with common Paper plugins.
  • Test database recovery.
  • Test credential leakage through logs and network traffic.
  • Document all vulnerabilities discovered and their remediation.

---

  1. PERFORMANCE REQUIREMENTS

The plugin should be production-oriented.

  • No blocking authentication requests on the main thread.
  • No unnecessary repeating tasks.
  • Bounded authentication queues.
  • Efficient session expiration.
  • Proper resource cleanup.
  • Safe plugin shutdown.
  • Minimal memory usage.
  • Database connection pooling where appropriate.
  • External API timeouts and retry limits.
  • No uncontrolled retry loops.

Security must not be weakened to improve performance.

---

  1. BUILD AND DELIVERY REQUIREMENTS

Deliver a complete, buildable project.

Required deliverables:

  1. Complete Java source code.
  2. Gradle build files and Gradle wrapper.
  3. "plugin.yml".
  4. All configuration files.
  5. Database implementation.
  6. Microsoft authentication integration.
  7. Security subsystem.
  8. Session management subsystem.
  9. Player commands.
  10. Administrator commands.
  11. Automated unit tests.
  12. Integration tests.
  13. Security test report.
  14. Installation documentation.
  15. Configuration documentation.
  16. Compiled "LunarLogin.jar".

The project must build successfully.

Do not provide incomplete classes, pseudocode, empty methods, fake authentication, or placeholder security implementations.

Do not claim a test passed unless it was actually executed.

---

  1. REQUIRED DEVELOPMENT WORKFLOW

Follow this engineering sequence:

PHASE 1 — Architecture Review

Analyze every requirement and identify technical conflicts. Produce a threat model and authentication architecture.

PHASE 2 — Security Design

Design the identity system, security state machine, session model, password handling, and database security.

PHASE 3 — Core Development

Implement the plugin architecture, authentication engine, database layer, and connection protection.

PHASE 4 — Advanced Security

Implement the Premium verification system, attack defenses, security monitoring, and audit logging.

PHASE 5 — Testing

Execute functional, integration, negative, and security tests.

PHASE 6 — Release

Build the final JAR, verify the artifact, document installation, and produce a release report.

Do not skip phases or silently downgrade requirements.

---

  1. FINAL ACCEPTANCE CRITERIA

LunarLogin will only be considered complete when:

  • Premium identity is independently verified.
  • Cracked accounts are protected by secure authentication.
  • One player cannot impersonate another.
  • Account registration cannot overwrite verified identities.
  • Authentication bypasses are prevented.
  • Session expiration and revocation work correctly.
  • Credentials are not exposed through unsafe transport or logging.
  • Database failures do not grant access.
  • All critical security tests pass.
  • The plugin operates on the specified Paper version.
  • The deliverable JAR is actually compiled and tested.

FINAL ENGINEERING DIRECTIVE

Build LunarLogin as a professional account-security product.

Do not build a cosmetic login system.

Do not trust usernames.

Do not trust offline UUIDs.

Do not trust client claims.

Do not trust unverified external responses.

Do not store plaintext credentials.

Do not silently bypass security checks.

Every authentication decision must be based on verified evidence.

When security and convenience conflict, security wins.

The objective is not to advertise LunarLogin as unhackable. The objective is to engineer it with a rigorous security model, a minimal attack surface, independently verifiable identity, and measurable resistance to account takeover.

Kodari AI
KodariNov 15 at 8:18 am 27
LunarLogin
LunarLogin is a high-security Minecraft authentication plugin for Paper 1.21.11 supporting both Premium and Cracked accounts. It implements a zero-trust architecture with Argon2id password hashing, cryptographically verified Microsoft account authentication through device-code flow, and a comprehensive pre-authentication firewall. The plugin features progressive rate limiting, session management with configurable expiration, premium identity protection against impersonation, SQLite/MySQL database support with parameterized queries, and a modular configuration system. It provides player commands for registration and login, administrative commands for account management, and a security monitoring subsystem that tracks suspicious activities and authentication attempts.

Feasibility: A standalone offline-mode Paper plugin cannot silently prove Microsoft ownership or secure passwords sent in Minecraft commands. I’ll fail closed instead: Premium verification requires an explicit Microsoft device-code flow, and cracked credentials are accepted only through a configured HTTPS endpoint. The requested password-bearing /LunarLogin <password> and /LunarRegister <password> <confirmPassword> forms will not be enabled over vanilla Minecraft chat.

  1. Build a Java 21 Paper plugin with SQLite/MySQL persistence, Argon2id hashing, rate limits, and audit events.

  2. Bind Premium verification and HTTPS credential challenges to the exact pending connection; keep sessions memory-only and require re-authentication after reconnect.

  3. Apply a server-side pre-authentication firewall, protected admin operations, configuration validation, and integration API.

  4. Add security/configuration documentation and focused tests; do not claim unrun tests or an unbuilt JAR as verified.

Created the LunarLogin Paper plugin source with Argon2id password hashing, SQLite/MySQL persistence, HTTPS browser login and registration, Microsoft device-code verification, connection-bound challenges, expiring memory-only sessions, an authentication event firewall, admin commands, configuration, documentation, and unit plus SQLite integration tests.

Important limitation: In offline mode, Minecraft chat is unencrypted. HTTPS protects browser-submitted passwords, but the one-time link and Microsoft device code are sent through that connection and may be intercepted. Connection binding cannot eliminate that risk. The project documents this limitation; HTTPS credentials and Premium verification are disabled until configured, and failed checks do not grant access. Cracked authentication also fails closed if Mojang’s public profile lookup is unavailable.

The tests have not been run, and no compiled JAR or Gradle wrapper is included, so this is not a verified production release. To build and download the JAR in Kodari: click Compile in the desktop top bar, or ⋮ → Compile Project on phone; click Compile in the window, then Download on the successful build.

New YT

The compilation failed with this error:

code
Compilation failed with 41 error(s):

ERROR in src/main/java/com/lunarlogin/security/PasswordHasher.java at line 3: package de.mkammerer.argon2 does not exist
import de.mkammerer.argon2.Argon2;
                          ^

ERROR in src/main/java/com/lunarlogin/security/PasswordHasher.java at line 4: package de.mkammerer.argon2 does not exist
import de.mkammerer.argon2.Argon2Factory;
                          ^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 7: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertEquals;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 7: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertEquals;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 8: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertNotNull;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 8: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertNotNull;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 9: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertNull;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 9: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertNull;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 5: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertFalse;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 5: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertFalse;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 6: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertTrue;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 6: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertTrue;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 5: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertFalse;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 5: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertFalse;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 6: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertTrue;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 6: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertTrue;
^

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 7: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertEquals;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 7: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertEquals;
^

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 8: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertThrows;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 8: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertThrows;
^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 4: package org.junit.jupiter.api.io does not exist
import org.junit.jupiter.api.io.TempDir;
                               ^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 9: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertEquals;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 9: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertEquals;
^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 10: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertFalse;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 10: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertFalse;
^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 11: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertTrue;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 11: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertTrue;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 12: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class ChallengeManagerTest

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 24: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class ChallengeManagerTest

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 9: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class PasswordHasherTest

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 17: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class PasswordHasherTest

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 9: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class RateLimiterTest

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 11: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class ConfigurationManagerTest

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 17: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class ConfigurationManagerTest

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 14: cannot find symbol
    @TempDir
     ^
  symbol: class TempDir
  location: class DatabaseManagerIntegrationTest

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 17: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class DatabaseManagerIntegrationTest


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - Test
  - TempDir
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/lunarlogin/security/PasswordHasher.java
  - src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java
  - src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java
  - src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java
  - src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java
  - src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariNov 15 at 8:49 am 3
  1. Make Argon2 and JUnit APIs explicitly available to compilation without packaging JUnit as a runtime library.

  2. Exclude misplaced test sources from the main source set while retaining Gradle’s normal test source set.

Updated build.gradle: Argon2 and the JUnit API are explicitly available on the compile classpath, and test/** is excluded from the main source set. JUnit remains a test dependency, not a plugin runtime dependency.

I haven’t run a build here, so the corrected JAR is not yet verified. Recompile in Kodari: click Compile (or ⋮ → Compile Project on phone), click Compile in the window, then Download if it succeeds.

New YT

The compilation failed with this error:

code
Compilation failed with 41 error(s):

ERROR in src/main/java/com/lunarlogin/security/PasswordHasher.java at line 3: package de.mkammerer.argon2 does not exist
import de.mkammerer.argon2.Argon2;
                          ^

ERROR in src/main/java/com/lunarlogin/security/PasswordHasher.java at line 4: package de.mkammerer.argon2 does not exist
import de.mkammerer.argon2.Argon2Factory;
                          ^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 7: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertEquals;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 7: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertEquals;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 8: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertNotNull;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 8: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertNotNull;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 9: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertNull;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 9: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertNull;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 5: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertFalse;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 5: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertFalse;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 6: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertTrue;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 6: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertTrue;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 5: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertFalse;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 5: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertFalse;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 6: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertTrue;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 6: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertTrue;
^

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 7: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertEquals;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 7: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertEquals;
^

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 8: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertThrows;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 8: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertThrows;
^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 4: package org.junit.jupiter.api.io does not exist
import org.junit.jupiter.api.io.TempDir;
                               ^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 9: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertEquals;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 9: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertEquals;
^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 10: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertFalse;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 10: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertFalse;
^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 11: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.assertTrue;
                                   ^

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 11: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertTrue;
^

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 12: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class ChallengeManagerTest

ERROR in src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java at line 24: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class ChallengeManagerTest

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 9: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class PasswordHasherTest

ERROR in src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java at line 17: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class PasswordHasherTest

ERROR in src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java at line 9: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class RateLimiterTest

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 11: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class ConfigurationManagerTest

ERROR in src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java at line 17: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class ConfigurationManagerTest

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 14: cannot find symbol
    @TempDir
     ^
  symbol: class TempDir
  location: class DatabaseManagerIntegrationTest

ERROR in src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java at line 17: cannot find symbol
    @Test
     ^
  symbol: class Test
  location: class DatabaseManagerIntegrationTest


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - Test
  - TempDir
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/lunarlogin/security/PasswordHasher.java
  - src/main/java/test/java/com/lunarlogin/security/ChallengeManagerTest.java
  - src/main/java/test/java/com/lunarlogin/security/PasswordHasherTest.java
  - src/main/java/test/java/com/lunarlogin/security/RateLimiterTest.java
  - src/main/java/test/java/com/lunarlogin/configuration/ConfigurationManagerTest.java
  - src/main/java/test/java/com/lunarlogin/database/DatabaseManagerIntegrationTest.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariNov 15 at 8:51 am 3

Fixed the compilation causes:

  • PasswordHasher no longer imports Argon2 classes at compile time. It still uses Argon2id at runtime and fails closed if the runtime library is unavailable.

  • Moved JUnit tests out of the main source tree and configured Gradle to run them from verification/java.

The source changes are in place, but I can’t claim a compiled JAR or passing tests without a successful build. Recompile in Kodari: click Compile (or ⋮ → Compile Project on phone), then Compile in the build window; download the JAR if the build succeeds.

New YT

Fix it

Kodari AI
KodariNov 15 at 8:57 am 1
  1. Exclude any nested test sources from the production Java compile path.

  2. Keep verification sources separate from production, without JUnit imports.

  3. Add the missing verification-suite entry point required by Gradle’s securityTest task.

Fixed the source-set issue: Gradle now excludes nested test files from production compilation, and the verification suite has the entry point required by the securityTest task. The current PasswordHasher also avoids compile-time Argon2 imports; its runtime dependency remains configured.

I haven’t run a build, so the JAR is not verified. Recompile in Kodari via Compile (phone: ⋮ → Compile Project), then download the JAR if it succeeds.

New YT

Run this build and see if any error

Kodari AI
KodariNov 15 at 8:58 am 1

I can’t start a build from this chat. Click Compile in the desktop top bar, or ⋮ → Compile Project on phone, then click Compile in the window. If it fails, paste the new error here and I’ll fix it.

Kodari can make mistakes. Review important code before using.
Files
src
verification
build.gradle
IMPORTANT.txt
manifest.kod
README.md
SECURITY-TEST-REPORT.md
SECURITY.md
settings.gradle
Code
38 2,722
src/main/java/com/lunarlogin/LunarLogin.java
package com.lunarlogin;

import com.lunarlogin.authentication.AuthenticationManager;
import com.lunarlogin.authentication.MicrosoftVerificationService;
import com.lunarlogin.authentication.PremiumIdentityService;
import com.lunarlogin.commands.LunarLoginCommand;
import com.lunarlogin.commands.RegisterCommand;
import com.lunarlogin.configuration.ConfigurationManager;
import com.lunarlogin.database.DatabaseManager;
import com.lunarlogin.listeners.AuthenticationListener;
import com.lunarlogin.listeners.FailClosedListener;
import com.lunarlogin.security.ChallengeManager;
import com.lunarlogin.security.HttpsCredentialServer;
import com.lunarlogin.security.PasswordHasher;
import com.lunarlogin.security.RateLimiter;
import com.lunarlogin.security.SecurityMonitor;
import com.lunarlogin.session.SessionManager;
import com.lunarlogin.utilities.MessageManager;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.IllegalPluginAccessException;

import java.io.File;
import java.sql.SQLException;
import java.util.function.Consumer;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

public final class LunarLogin extends JavaPlugin {
    private ConfigurationManager configurationManager;
    private ExecutorService executor;
    private DatabaseManager database;
    private SessionManager sessionManager;
    private ChallengeManager challengeManager;
    private AuthenticationManager authenticationManager;
    private SecurityMonitor securityMonitor;
    private MicrosoftVerificationService microsoftVerification;
    private HttpsCredentialServer httpsCredentialServer;
    private ExecutorService microsoftExecutor;
    private MessageManager messageManager;
    private volatile boolean runtimeReady;
    private volatile boolean shuttingDown;

    private record RuntimeSettings(File dataFolder, DatabaseManager.Settings database, int auditAlertThreshold,
                                   int auditRetentionDays, int argonIterations, int argonMemoryKiB, int argonParallelism,
                                   int minimumPasswordLength, int maximumPasswordLength, int maximumLoginAttempts,
                                   int authenticationTimeoutSeconds, long sessionDurationMillis, boolean premiumEnabled,
                                   String premiumClientId, String premiumScope, int premiumTimeoutSeconds,
                                   boolean httpsEnabled, String httpsBindAddress, int httpsPort, String httpsKeystorePath,
                                   String httpsKeystoreType, String httpsPasswordEnv, String httpsPublicBaseUrl) {
    }

    @Override
    public void onEnable() {
        this.shuttingDown = false;
        this.configurationManager = new ConfigurationManager(this);
        this.configurationManager.saveResources();
        this.messageManager = new MessageManager(this);
        try {
            this.configurationManager.validate();
            RuntimeSettings settings = this.snapshotSettings();
            this.initializeExecutors();
            this.startInitialization(settings);
        } catch (Exception exception) {
            this.getLogger().severe("LunarLogin could not start securely: " + exception.getMessage());
            this.closeServices();
            new FailClosedListener(this, () -> this.runtimeReady);
        }
    }

    private void startInitialization(RuntimeSettings settings) {
        new FailClosedListener(this, () -> this.runtimeReady);
        try {
            this.executor.execute(() -> {
                Exception failure = null;
                try {
                    this.initializeServices(settings);
                } catch (Exception exception) {
                    failure = exception;
                }
                if (this.shuttingDown) {
                    this.closeServices();
                    return;
                }
                Exception result = failure;
                try {
                    Bukkit.getScheduler().runTask(this, () -> this.finishStartup(result));
                } catch (IllegalPluginAccessException exception) {
                    this.closeServices();
                }
            });
        } catch (java.util.concurrent.RejectedExecutionException exception) {
            this.finishStartup(exception);
        }
    }

    private void initializeExecutors() {
        AtomicInteger threadNumber = new AtomicInteger();
        ThreadFactory factory = task -> {
            Thread thread = new Thread(task, "LunarLogin-worker-" + threadNumber.incrementAndGet());
            thread.setDaemon(true);
            return thread;
        };
        this.executor = new ThreadPoolExecutor(4, 4, 0, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(64), factory, new ThreadPoolExecutor.AbortPolicy());
        this.microsoftExecutor = new ThreadPoolExecutor(2, 2, 0, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(16), factory, new ThreadPoolExecutor.AbortPolicy());
    }

    private RuntimeSettings snapshotSettings() {
        var config = this.getConfig();
        var database = org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(new File(this.getDataFolder(), "database.yml"));
        var security = org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(new File(this.getDataFolder(), "security.yml"));
        var premium = org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(new File(this.getDataFolder(), "premium.yml"));
        DatabaseManager.Settings databaseSettings = new DatabaseManager.Settings(
                database.getString("type", "SQLITE"), database.getString("sqlite-file", "accounts.db"),
                database.getInt("connection-timeout-seconds", 5), database.getString("mysql.host", "127.0.0.1"),
                database.getInt("mysql.port", 3306), database.getString("mysql.database", "lunarlogin"),
                database.getString("mysql.username", "lunarlogin"), database.getString("mysql.password-env", "LUNARLOGIN_MYSQL_PASSWORD"),
                database.getString("mysql.ssl-mode", "VERIFY_IDENTITY"));
        return new RuntimeSettings(this.getDataFolder(), databaseSettings, security.getInt("monitor.alert-threshold", 5),
                security.getInt("monitor.retain-events-days", 90), config.getInt("security.password.argon2id-iterations"),
                config.getInt("security.password.argon2id-memory-kib"), config.getInt("security.password.argon2id-parallelism"),
                config.getInt("security.password.minimum-length"), config.getInt("security.password.maximum-length"),
                config.getInt("security.maximum-login-attempts", 5), config.getInt("security.authentication-timeout-seconds"),
                this.configurationManager.sessionDurationMillis(), premium.getBoolean("enabled", false),
                premium.getString("device-code.client-id", ""), premium.getString("device-code.scope", "XboxLive.signin offline_access"),
                premium.getInt("device-code.timeout-seconds", 900), config.getBoolean("security.credentials.https-enabled", false),
                config.getString("security.credentials.bind-address", "0.0.0.0"), config.getInt("security.credentials.port", 9443),
                config.getString("security.credentials.keystore-path", "plugins/LunarLogin/https.p12"),
                config.getString("security.credentials.keystore-type", "PKCS12"),
                config.getString("security.credentials.keystore-password-env", "LUNARLOGIN_KEYSTORE_PASSWORD"),
                config.getString("security.credentials.public-base-url", ""));
    }

    private void finishStartup(Exception failure) {
        if (failure != null) {
            this.getLogger().severe("LunarLogin could not start securely: " + failure.getMessage());
            this.closeServices();
            return;
        }
        Bukkit.getPluginManager().registerEvents(new AuthenticationListener(this), this);
        LunarLoginCommand command = new LunarLoginCommand(this);
        this.getCommand("lunarlogin").setExecutor(command);
        this.getCommand("lunarlogin").setTabCompleter(command);
        this.getCommand("lunarregister").setExecutor(new RegisterCommand(this));
        for (Player player : Bukkit.getOnlinePlayers()) this.beginAuthentication(player);
        this.runtimeReady = true;
        this.getLogger().info("LunarLogin enabled in fail-closed mode.");
    }

    private void initializeServices(RuntimeSettings settings) throws Exception {
        this.database = new DatabaseManager(settings.dataFolder(), settings.database(), settings.auditRetentionDays());
        this.sessionManager = new SessionManager(this);
        this.challengeManager = new ChallengeManager(10000);
        this.securityMonitor = new SecurityMonitor(this, this.database, this.executor, settings.auditAlertThreshold());
        PasswordHasher passwordHasher = new PasswordHasher(settings.argonIterations(), settings.argonMemoryKiB(), settings.argonParallelism(),
                settings.minimumPasswordLength(), settings.maximumPasswordLength());
        RateLimiter rateLimiter = new RateLimiter(settings.maximumLoginAttempts(), 1000, 300000, 100000);
        long sessionDuration = settings.sessionDurationMillis();
        PremiumIdentityService identities = new PremiumIdentityService(this.database, this.securityMonitor);
        this.authenticationManager = new AuthenticationManager(this, this.database, passwordHasher, identities, this.sessionManager, this.messageManager,
                this.challengeManager, this.securityMonitor, rateLimiter, this.executor,
                settings.authenticationTimeoutSeconds(), settings.maximumPasswordLength(), sessionDuration);
        this.microsoftVerification = new MicrosoftVerificationService(this, this.authenticationManager, identities, this.securityMonitor,
                this.microsoftExecutor, settings.premiumEnabled(), settings.premiumClientId(), settings.premiumScope(), settings.premiumTimeoutSeconds(), sessionDuration);
        if (settings.httpsEnabled()) {
            this.httpsCredentialServer = new HttpsCredentialServer(this, this.authenticationManager, this.securityMonitor, this.executor,
                    settings.httpsBindAddress(), settings.httpsPort(), settings.httpsKeystorePath(), settings.httpsKeystoreType(),
                    settings.httpsPasswordEnv(), settings.httpsPublicBaseUrl());
        }
    }

    public void beginAuthentication(Player player) {
        this.authenticationManager.beginConnection(player);
        if (player.hasPermission("lunarlogin.bypass")) return;
        this.messageManager.send(player, "login-required", "Authenticate before using server features.");
        if (this.httpsCredentialServer != null) this.sendCredentialLink(player);
        else this.messageManager.send(player, "https-unavailable", "Secure HTTPS credential login is not configured.");
        if (this.microsoftVerification.start(player)) player.sendMessage("§bIf this is a Premium account, complete the Microsoft device verification shown shortly.");
        long timeoutSeconds = Math.max(this.getConfig().getLong("security.authentication-timeout-seconds", 120), this.microsoftVerification.pendingTimeoutSeconds());
        long timeout = timeoutSeconds * 20;
        Bukkit.getScheduler().runTaskLater(this, () -> {
            if (player.isOnline() && !this.isAuthenticated(player.getUniqueId()) && !player.hasPermission("lunarlogin.bypass")) {
                player.kickPlayer("Authentication timed out. Reconnect and authenticate securely.");
            }
        }, timeout);
    }

    public void sendCredentialLink(Player player) {
        if (this.httpsCredentialServer == null) {
            this.messageManager.send(player, "https-unavailable", "Secure HTTPS credential login is not configured.");
            return;
        }
        try {
            String challenge = this.authenticationManager.newCredentialChallenge(player);