Fixes for authlib-injector accounts#2890
Open
evan-goode wants to merge 4 commits intoMCCTeam:masterfrom
Open
Conversation
The previous authlib-injector authentication implementation always assumed that the authlib-injector API location was located at https://authlibinjectorserver.example.com/api/yggdrasil. Blessing Skin structures their API like that, but other authlib-injector-compatible Yggdrasil implementations do not. Per the authlib-injector specification, the API root can be located at any path, and that path should be pointed to by the `X-Authlib-Injector-API-Location` header [1]. With this change, the default AuthlibInjectorAPIPath is kept as `/api/yggdrasil`, so users will not need to update their config. See also unmojang/drasl#66 (comment). [1] https://github.com/yushijinhun/authlib-injector/wiki/Yggdrasil-%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%8A%80%E6%9C%AF%E8%A7%84%E8%8C%83
Instead of sending an invalid profile key signature, it's better to just send no signature. If we send an invalid signature, the vanilla server will throw an error even if `enforce-secure-profile` is `false`. See also yushijinhun/authlib-injector#266.
The DIY HTTP client had many problems, as is expected when rolling your own HTTP implementation without following the spec. Fortunately, we can use SocketsHttpHandler.ConnectCallback to make HttpClient use our custom TCP client.
Some authlib-injector-compatible authentication servers implement the POST /player/certificates route used for fetching player certificates. To comply with the authlib-injector Yggdrasil server specification [1], we first query the authlib-injector metadata and check for the `feature.enable_profile_key` flag. If the flag is set, the authentication server supports the /player/certificates route. In this case, checking the authlib-injector metadata isn't really necessary; if the /player/certificates request fails for any reason, we simply ignore it anyway. [1] https://github.com/yushijinhun/authlib-injector/wiki/Yggdrasil-%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%8A%80%E6%9C%AF%E8%A7%84%E8%8C%83
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.
This PR includes several fixes for authlib-injector (here called "Yggdrasil" or "Authlib") accounts. For unmojang/drasl#66.
Main.General.AuthServer.AuthlibInjectorAPIPath, to allow specifying the path to the root of the authlib-injector API. Whereas Blessing Skin places their API at/api/yggdrasil, other authlib-injector servers (Drasl, Ely.By) do not, so this change enables compatibility with them.AuthServerconfig optionsDoHTTPSRequestwithSystem.Net.Http.HttpClient, but still respect the configured proxy.TcpClienttoHttpClient---that's what I did here. It sent the request through my TCP proxy when I tested it. Is this correct?feature.enable_profile_keyflag setSee commit message for more details. I'm a C# amateur, so a thorough review would be appreciated :)