mirror of
https://github.com/Minestom/Minestom.git
synced 2024-06-27 23:15:04 +02:00
Make Mojang SessionServer Configurable (#499)
This commit is contained in:
parent
b6bce86eca
commit
11d0f82b86
|
@ -26,6 +26,7 @@ import java.util.Arrays;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class EncryptionResponsePacket implements ClientPreplayPacket {
|
public class EncryptionResponsePacket implements ClientPreplayPacket {
|
||||||
|
private static final String MOJANG_AUTH_URL = System.getProperty("minestom.auth.url", "https://sessionserver.mojang.com/session/minecraft/hasJoined").concat("?username=%s&serverId=%s");
|
||||||
private static final Gson GSON = new Gson();
|
private static final Gson GSON = new Gson();
|
||||||
private byte[] sharedSecret;
|
private byte[] sharedSecret;
|
||||||
private byte[] verifyToken;
|
private byte[] verifyToken;
|
||||||
|
@ -64,9 +65,7 @@ public class EncryptionResponsePacket implements ClientPreplayPacket {
|
||||||
final String serverId = new BigInteger(digestedData).toString(16);
|
final String serverId = new BigInteger(digestedData).toString(16);
|
||||||
final String username = URLEncoder.encode(loginUsername, StandardCharsets.UTF_8);
|
final String username = URLEncoder.encode(loginUsername, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
final String url = "https://sessionserver.mojang.com/session/minecraft/hasJoined?"
|
final String url = String.format(MOJANG_AUTH_URL, username, serverId);
|
||||||
+ "username=" + username + "&"
|
|
||||||
+ "serverId=" + serverId;
|
|
||||||
// TODO: Add ability to add ip query tag. See: https://wiki.vg/Protocol_Encryption#Authentication
|
// TODO: Add ability to add ip query tag. See: https://wiki.vg/Protocol_Encryption#Authentication
|
||||||
|
|
||||||
final HttpClient client = HttpClient.newHttpClient();
|
final HttpClient client = HttpClient.newHttpClient();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user