diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthRequest.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthRequest.java index f9e2e7f5..59606788 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthRequest.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthRequest.java @@ -20,7 +20,7 @@ public final class AuthRequest extends Request implements Requ private final String login; private final byte[] encryptedPassword; - private final int auth_id; + private final String auth_id; private final HWID hwid; private final String customText; @@ -31,20 +31,11 @@ public AuthRequest(LauncherConfig config, String login, byte[] password, HWID hw this.encryptedPassword = password.clone(); this.hwid = hwid; customText = ""; - auth_id = 0; - } - @LauncherAPI - public AuthRequest(LauncherConfig config, String login, byte[] password, HWID hwid, String customText) { - super(config); - this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty"); - this.encryptedPassword = password.clone(); - this.hwid = hwid; - this.customText = customText; - auth_id = 0; + auth_id = ""; } @LauncherAPI - public AuthRequest(LauncherConfig config, String login, byte[] password, HWID hwid, int auth_id) { + public AuthRequest(LauncherConfig config, String login, byte[] password, HWID hwid, String auth_id) { super(config); this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty"); this.encryptedPassword = password.clone(); @@ -53,7 +44,7 @@ public AuthRequest(LauncherConfig config, String login, byte[] password, HWID hw customText = ""; } @LauncherAPI - public AuthRequest(LauncherConfig config, String login, byte[] password, HWID hwid, String customText, int auth_id) { + public AuthRequest(LauncherConfig config, String login, byte[] password, HWID hwid, String customText, String auth_id) { super(config); this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty"); this.encryptedPassword = password.clone(); @@ -72,7 +63,7 @@ public AuthRequestEvent requestWebSockets() throws Exception return (AuthRequestEvent) LegacyRequestBridge.sendRequest(this); } @LauncherAPI - public AuthRequest(String login, byte[] password, HWID hwid, int auth_id) { + public AuthRequest(String login, byte[] password, HWID hwid, String auth_id) { this(null, login, password, hwid, auth_id); } @@ -104,7 +95,7 @@ protected AuthRequestEvent requestDo(HInput input, HOutput output) throws IOExce output.writeBoolean(Launcher.profile != null); if (Launcher.profile != null) output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT); - output.writeInt(auth_id); + output.writeString(auth_id, SerializeLimits.MAX_QUEUE_SIZE); output.writeString(hwid.getSerializeString(), 0); //output.writeLong(0); //output.writeLong(0); diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthServerRequest.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthServerRequest.java index 829fc0a3..3c5fd0e8 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthServerRequest.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/AuthServerRequest.java @@ -30,7 +30,7 @@ private Result(PlayerProfile pp, String accessToken) { private final String login; private final byte[] encryptedPassword; - private final int auth_id; + private final String auth_id; private final String title; @LauncherAPI @@ -38,12 +38,12 @@ public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPa super(config); this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty"); this.encryptedPassword = encryptedPassword.clone(); - auth_id = 0; + auth_id = ""; title = ""; } @LauncherAPI - public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPassword, int auth_id) { + public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPassword, String auth_id) { super(config); this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty"); this.encryptedPassword = encryptedPassword.clone(); @@ -52,7 +52,7 @@ public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPa } @LauncherAPI - public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPassword, int auth_id, String title) { + public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPassword, String auth_id, String title) { super(config); this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty"); this.encryptedPassword = encryptedPassword.clone(); @@ -66,7 +66,7 @@ public AuthServerRequest(String login, byte[] encryptedPassword) { } @LauncherAPI - public AuthServerRequest(String login, byte[] encryptedPassword, int auth_id) { + public AuthServerRequest(String login, byte[] encryptedPassword, String auth_id) { this(null, login, encryptedPassword, auth_id); } @@ -79,7 +79,7 @@ public Integer getLegacyType() { protected ClientPermissions requestDo(HInput input, HOutput output) throws IOException { output.writeString(login, SerializeLimits.MAX_LOGIN); output.writeString(title, SerializeLimits.MAX_CLIENT); - output.writeInt(auth_id); + output.writeString(auth_id, SerializeLimits.MAX_QUEUE_SIZE); output.writeByteArray(encryptedPassword, SecurityHelper.CRYPTO_MAX_LENGTH); output.flush(); diff --git a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java index 74bf4a53..999b8593 100644 --- a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java +++ b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java @@ -43,7 +43,7 @@ public class ServerWrapper { public static boolean auth(ServerWrapper wrapper) { try { LauncherConfig cfg = Launcher.getConfig(); - ServerWrapper.permissions = new AuthServerRequest(cfg, config.login, SecurityHelper.newRSAEncryptCipher(cfg.publicKey).doFinal(IOHelper.encode(config.password)), 0, config.title).request(); + ServerWrapper.permissions = new AuthServerRequest(cfg, config.login, SecurityHelper.newRSAEncryptCipher(cfg.publicKey).doFinal(IOHelper.encode(config.password)), config.auth_id, config.title).request(); ProfilesRequestEvent result = new ProfilesRequest(cfg).request(); for (ClientProfile p : result.profiles) { LogHelper.debug("Get profile: %s", p.getTitle()); @@ -218,6 +218,7 @@ public static final class Config { public String login; public String[] args; public String password; + public String auth_id = ""; public LauncherConfig.LauncherEnvironment env; }