Draft
Conversation
…s quite odd this wasn't the case.
…ests. (serverside for right now.)
… text in the buffer before switching to asterisks when sent to exchange for token. (elyby)
…] and related classes.
…move' and handle profile removal
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as spam.
This comment was marked as spam.
Collaborator
|
Please refactor AuthModule, the auth implementations should not be in one large monolithic file. Separate them out. |
Contributor
Contributor
|
yo u lowk just made a big ass arguement on the discord server how u feel? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
adds a full authentication system to minecraftconsoles. msft oauth device code flow, ely.by auth, and offline mode. includes server-side enforced auth handshake, a profile manager with persistent storage, UUID identity system, XUID-to-UUID migration, and configurable [auth-mode] for dedicated servers. also adds libcurl as a dependency for HTTPS and moves nlohmann/json into {include/Common/vendor]. (for now we are gonna keep the old xuid data, but push it out with a future patch.)
Changes
see new behavior
Previous Behavior
the original codebase was built for consoles where platform-level auth (xbl, psn, etc) handled identity. as we port it to windows, none of this exists, so we are faking this idenitity. as such,there is no HTTP client to talk to auth servers, no handshake protocol to negotiate authentication schemes, and no UUID system to give players a stable cross-platform identity. the [PreLoginPacket] name field could also overwrite an already-authenticated username which was a pretty obvious security hole once real auth was in place. big no no!!! (also msft store button was going unused.)
Root Cause
the original codebase was built for consoles where platform-level auth (Xbox Live, PSN) handled identity. when the project got ported to Windows none of that infrastructure existed, so identity was basically faked. there was no HTTP client to talk to auth servers, no handshake protocol to negotiate authentication schemes, and no UUID system to give players a stable cross-platform identity. the [PreLoginPacket] name field could also overwrite an already-authenticated username which was a pretty obvious security hole once real auth was in place.
New Behavior
players now authenticate through one of three methods. msft (oauth device code flow that opens a browser and polls for completion), Ely.by (uses user and pass to get token), or Offline (trusts user are who they say they are). the server declares which auth scheme it requires via a new [auth-mode] property ([session] or [offline]), and a full 11-stage handshake protocol negotiates and verifies identity before the player ever gets past the login screen.
(funnily enough, msft sees us as minecraft for nintendo switch when autodetected. not bedrock, the original.)
continuing:
profiles now exist in a binary "auth_profiles.dat" file with token refresh support for both Microsoft and Ely.by. the in-game UI lets you add, remove, cycle through, and apply profiles. players get a [GameUUID] (v5 UUID derived from their identity) that gets serialized in [LoginPacket] and [AddPlayerPacket]. existing ban/whitelist entries with XUIDs automatically get backfilled with UUIDs on load, and player save files get migrated from XUID-named ".dat" files to UUID-named ones.
if auth fails the client gets a proper [eDisconnect_AuthFailed] disconnect reason with a localized error message instead of just getting silently dropped.
Fix Implementation
the core of this is a new [HttpClient], [AuthModule] hierarchy (session/offline/keypair-offline), [AuthPackets] (11-stage enum with key-value fields), and a [HandshakeManager] state machine that drives the whole protocol from both sides.
[AuthScreen] handles the threaded OAuth/ely.by auth flows and profile persistence in a binary auth_profiles.dat. [UUID.h/cpp] implements GameUUID with a custom SHA-1 for v5 generation and deterministic XUID conversion. on the server side,
[PendingConnection] now runs [initAuth()] based on [auth-mode] from [ServerProperties], guards [PreLoginPacket] name overwrites, and disconnects with [eDisconnect_AuthFailed] on failure.
[ClientConnection] mirrors this on the client side and syncs the authenticated name back into the platform globals. [DirectoryLevelStorage] handles XUID-to-UUID save file migration, and [BanManager]/[WhitelistManager] backfill UUIDs on load. [UIScene_MainMenu] got the full profile management UI with next/use/add/remove,
AI Use Disclosure
no ai was used to make this
Related Issues