diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthServerResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthServerResponse.java index c7bc2183..87fa5f32 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthServerResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthServerResponse.java @@ -52,7 +52,6 @@ public void reply() throws Exception { requestError("ServerPassword decryption error"); return; } - if(client.length() == 0) requestError("Request error. You is cheater?"); // Authenticate debug("ServerLogin: '%s', Password: '%s'", login, echo(password.length())); AuthProviderResult result; 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 83cb5faa..3c06ef46 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 @@ -31,6 +31,7 @@ private Result(PlayerProfile pp, String accessToken) { private final byte[] encryptedPassword; private final int auth_id; + private final String title; @LauncherAPI public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPassword) { @@ -38,6 +39,7 @@ public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPa this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty"); this.encryptedPassword = encryptedPassword.clone(); auth_id = 0; + title = ""; } @LauncherAPI public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPassword, int auth_id) { @@ -45,6 +47,15 @@ public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPa this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty"); this.encryptedPassword = encryptedPassword.clone(); this.auth_id = auth_id; + title = ""; + } + @LauncherAPI + public AuthServerRequest(LauncherConfig config, String login, byte[] encryptedPassword, int auth_id,String title) { + super(config); + this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty"); + this.encryptedPassword = encryptedPassword.clone(); + this.auth_id = auth_id; + this.title = title; } @LauncherAPI @@ -64,7 +75,7 @@ public Integer getType() { @Override protected Boolean requestDo(HInput input, HOutput output) throws IOException { output.writeString(login, SerializeLimits.MAX_LOGIN); - output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT); + output.writeString(title, SerializeLimits.MAX_CLIENT); output.writeInt(auth_id); 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 046bddbc..e38633a6 100644 --- a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java +++ b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java @@ -44,7 +44,7 @@ public static void main(String[] args) throws Throwable { config = new Config(TextConfigReader.read(reader, true)); } LauncherConfig cfg = new LauncherConfig(config.address, config.port, SecurityHelper.toPublicRSAKey(IOHelper.read(Paths.get("public.key"))),new HashMap<>(),config.projectname); - Boolean auth = new AuthServerRequest(cfg,config.login,SecurityHelper.newRSAEncryptCipher(cfg.publicKey).doFinal(IOHelper.encode(config.password))).request(); + Boolean auth = new AuthServerRequest(cfg,config.login,SecurityHelper.newRSAEncryptCipher(cfg.publicKey).doFinal(IOHelper.encode(config.password)),0,config.title).request(); ProfilesRequest.Result result = new ProfilesRequest(cfg).request(); Launcher.setConfig(cfg);