Minecraft-Console-Client/MinecraftClient/Protocol
Anon ff9aa62702 Add configurable authlib-injector API path and HTTP support for Yggdrasil auth
Re-implements the changes from PR #2890, adapted for the current codebase
which uses System.Text.Json.Nodes and HttpClient instead of the legacy
Json.JSONData and hand-rolled SslStream HTTP client.

Changes:
- Settings.cs: Convert AuthlibServer from struct to class with
  [TomlDoNotInlineObject]; convert Host to a property that parses
  'host:port' syntax; add AuthlibInjectorAPIPath (default '/api/yggdrasil')
  for servers that use a different prefix (e.g. Drasl uses '/authlib-injector');
  add UseHttps (default true) so local/dev auth servers without TLS work.

- ConfigComments.resx: Add descriptive inline comments for the new
  AuthlibServer fields (Host, Port, AuthlibInjectorAPIPath, UseHttps).

- ProtocolHandler.cs: Replace three hardcoded '/api/yggdrasil/...' paths
  with AuthlibInjectorAPIPath-based paths (authenticate, refresh, join).
  Replace hand-rolled TcpClient+SslStream HTTP in DoHTTPSRequest with
  HttpClient+SocketsHttpHandler (ConnectCallback routes through ProxyHandler).
  Add useHttps parameter so HTTP-only auth servers are supported.

- KeyUtils.cs: Add AuthServerSupportsProfileKeys() that fetches the
  authlib-injector metadata endpoint and checks feature.enable_profile_key.
  Update GetNewProfileKeys() to skip key fetch when the auth server does not
  support profile keys; build the cert URL dynamically using AuthlibInjectorAPIPath
  for Yggdrasil; always fetch real certs instead of returning a dummy response.
  Remove MakeDummyResponse() which is no longer needed.

Tested against a local Drasl instance with authlib-injector 1.2.7 on a
1.21.11 Minecraft server — full auth flow (login, profile key fetch, session
join) confirmed working end-to-end.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-23 00:15:32 +01:00
..
Handlers Fix offline Microsoft auth profile-key checks and complete status ping/pong during auto-version detection. 2026-03-22 22:19:59 +01:00
Message Address code review feedback 2026-03-22 16:46:33 +00:00
ProfileKey Add configurable authlib-injector API path and HTTP support for Yggdrasil auth 2026-03-23 00:15:32 +01:00
Session Replace legacy custom JSON parser with System.Text.Json 2026-03-22 16:39:26 +00:00
DataTypeGenerator.cs Replace legacy custom JSON parser with System.Text.Json 2026-03-22 16:39:26 +00:00
EntityActionType.cs [SKIP_BUILD] Change file encoding to UTF-8 with BOM 2022-11-28 13:55:05 +08:00
GuidExtensions.cs Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
IMinecraftCom.cs 1.20.6 - Not working yet 2024-06-16 01:19:09 +02:00
IMinecraftComHandler.cs First working version, not fully tested 2024-06-30 11:26:41 +02:00
JwtPayloadDecode.cs Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
MicrosoftAuthentication.cs Replace legacy custom JSON parser with System.Text.Json 2026-03-22 16:39:26 +00:00
MojangAPI.cs Replace legacy custom JSON parser with System.Text.Json 2026-03-22 16:39:26 +00:00
PlayerInfo.cs Trim 2023-01-14 21:07:09 +08:00
ProtocolHandler.cs Add configurable authlib-injector API path and HTTP support for Yggdrasil auth 2026-03-23 00:15:32 +01:00
ProxiedWebRequest.cs Address code review feedback 2026-03-22 16:46:33 +00:00
ReplayHandler.cs Implemented .net 10 support. Updated all affected libraries and the code. Not testes yet. 2026-03-21 20:07:20 +01:00