From dab963a2eba932adcb2dbb51c232304954714650 Mon Sep 17 00:00:00 2001 From: Gravit Date: Thu, 27 Sep 2018 05:00:46 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20title=20=D0=BF=D1=80=D0=B8=20AuthSer?= =?UTF-8?q?verRequest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../response/auth/AuthServerResponse.java | 1 - .../launcher/request/auth/AuthServerRequest.java | 13 ++++++++++++- .../ru/gravit/launcher/server/ServerWrapper.java | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) 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);