From a9cc2841acab2ac4372833f2c76d56cf03b8b96b Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 22 Mar 2019 09:55:30 +0700 Subject: [PATCH 1/8] =?UTF-8?q?[FIX]=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BE?= =?UTF-8?q?=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20json=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D0=BE=D0=B2=20=D0=BA=20mojang?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/ru/gravit/utils/HTTPRequest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libLauncher/src/main/java/ru/gravit/utils/HTTPRequest.java b/libLauncher/src/main/java/ru/gravit/utils/HTTPRequest.java index dacf0164..393d7d87 100644 --- a/libLauncher/src/main/java/ru/gravit/utils/HTTPRequest.java +++ b/libLauncher/src/main/java/ru/gravit/utils/HTTPRequest.java @@ -58,8 +58,12 @@ public static JsonElement jsonRequest(JsonElement request, URL url) throws IOExc reader = new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8); else reader = new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8); - JsonElement content = parser.parse(reader); - return content; + try { + return parser.parse(reader); + } catch (Exception e) + { + return null; + } } private HTTPRequest() { From c9c867d8f3830eafe7046d3c04f38668e90a5ab2 Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 22 Mar 2019 11:04:42 +0700 Subject: [PATCH 2/8] [FEATURE] [CRITICAL] AuthProviderPair --- .../ru/gravit/launchserver/LaunchServer.java | 91 ++++++++++++------- .../launchserver/auth/AuthProviderPair.java | 24 +++++ .../auth/provider/AuthProvider.java | 4 - .../command/auth/AuthCommand.java | 12 ++- .../command/auth/UUIDToUsernameCommand.java | 10 +- .../command/auth/UsernameToUUIDCommand.java | 9 +- .../command/dump/DumpEntryCacheCommand.java | 13 ++- .../command/handler/CommandHandler.java | 1 - .../command/service/ServerStatusCommand.java | 9 +- .../service/SwapAuthProviderCommand.java | 63 ------------- .../response/auth/AuthResponse.java | 14 ++- .../response/auth/AuthServerResponse.java | 12 ++- .../response/auth/CheckServerResponse.java | 2 +- .../response/auth/JoinServerResponse.java | 2 +- .../BatchProfileByUsernameResponse.java | 2 +- .../profile/ProfileByUUIDResponse.java | 2 +- .../profile/ProfileByUsernameResponse.java | 7 +- .../ru/gravit/launchserver/socket/Client.java | 14 ++- .../websocket/json/auth/AuthResponse.java | 16 +++- .../json/auth/CheckServerResponse.java | 2 +- .../json/auth/JoinServerResponse.java | 2 +- .../json/profile/BatchProfileByUsername.java | 2 +- .../json/profile/ProfileByUUIDResponse.java | 2 +- .../json/profile/ProfileByUsername.java | 2 +- modules | 2 +- 25 files changed, 177 insertions(+), 142 deletions(-) create mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java delete mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/command/service/SwapAuthProviderCommand.java diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index c12dbc13..8a1b6e5a 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -9,6 +9,7 @@ import ru.gravit.launcher.profiles.ClientProfile; import ru.gravit.launcher.serialize.signed.SignedObjectHolder; import ru.gravit.launchserver.auth.AuthLimiter; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.auth.handler.AuthHandler; import ru.gravit.launchserver.auth.handler.MemoryAuthHandler; import ru.gravit.launchserver.auth.hwid.AcceptHWIDHandler; @@ -46,8 +47,6 @@ import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; import java.security.spec.InvalidKeySpecException; -import java.time.Duration; -import java.time.Instant; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.atomic.AtomicBoolean; @@ -63,10 +62,9 @@ public void reload() throws Exception { } config.verify(); Launcher.applyLauncherEnv(config.env); - for (AuthProvider provider : config.authProvider) { - provider.init(); + for (AuthProviderPair auth : config.auth) { + auth.init(); } - config.authHandler.init(); } public static final class Config { @@ -86,9 +84,32 @@ public static final class Config { // Handlers & Providers - public AuthProvider[] authProvider; + public AuthProviderPair[] auth; - public AuthHandler authHandler; + private transient AuthProviderPair authDefault; + + public AuthProviderPair getAuthProviderPair(String name) + { + for(AuthProviderPair pair : auth) + { + if(pair.name.equals(name)) return pair; + } + return null; + } + + public AuthProviderPair getAuthProviderPair() + { + if(authDefault != null) return authDefault; + for(AuthProviderPair pair : auth) + { + if(pair.isDefault) + { + authDefault = pair; + return pair; + } + } + return null; + } public PermissionsHandler permissionsHandler; @@ -165,11 +186,21 @@ public void setAddress(String address) { public void verify() { VerifyHelper.verify(getAddress(), VerifyHelper.NOT_EMPTY, "LaunchServer address can't be empty"); - if (authHandler == null) { + if (auth == null || auth[0] == null) { throw new NullPointerException("AuthHandler must not be null"); } - if (authProvider == null || authProvider[0] == null) { - throw new NullPointerException("AuthProvider must not be null"); + boolean isOneDefault = false; + for(AuthProviderPair pair : auth) + { + if(pair.isDefault) + { + isOneDefault = true; + break; + } + } + if(!isOneDefault) + { + throw new IllegalStateException("No auth pairs declared by default."); } if (textureProvider == null) { throw new NullPointerException("TextureProvider must not be null"); @@ -188,12 +219,7 @@ public void verify() { public void close() { try { - authHandler.close(); - } catch (IOException e) { - LogHelper.error(e); - } - try { - for (AuthProvider p : authProvider) p.close(); + for (AuthProviderPair p : auth) p.close(); } catch (IOException e) { LogHelper.error(e); } @@ -443,10 +469,9 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE } config.verify(); Launcher.applyLauncherEnv(config.env); - for (AuthProvider provider : config.authProvider) { + for (AuthProviderPair provider : config.auth) { provider.init(); } - config.authHandler.init(); // build hooks, anti-brutforce and other buildHookManager = new BuildHookManager(); @@ -463,12 +488,12 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE reloadManager.registerReloadable("launchServer", this); if (config.permissionsHandler instanceof Reloadable) reloadManager.registerReloadable("permissionsHandler", (Reloadable) config.permissionsHandler); - if (config.authHandler instanceof Reloadable) - reloadManager.registerReloadable("authHandler", (Reloadable) config.authHandler); - for (int i = 0; i < config.authProvider.length; ++i) { - AuthProvider provider = config.authProvider[i]; - if (provider instanceof Reloadable) - reloadManager.registerReloadable("authHandler".concat(String.valueOf(i)), (Reloadable) provider); + for (int i = 0; i < config.auth.length; ++i) { + AuthProviderPair pair = config.auth[i]; + if (pair.provider instanceof Reloadable) + reloadManager.registerReloadable("auth.".concat(pair.name).concat(".provider"), (Reloadable) pair.provider); + if (pair.handler instanceof Reloadable) + reloadManager.registerReloadable("auth.".concat(pair.name).concat(".handler"), (Reloadable) pair.handler); } if (config.textureProvider instanceof Reloadable) reloadManager.registerReloadable("textureProvider", (Reloadable) config.textureProvider); @@ -477,12 +502,12 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE if (config.permissionsHandler instanceof Reconfigurable) reconfigurableManager.registerReconfigurable("permissionsHandler", (Reconfigurable) config.permissionsHandler); - if (config.authHandler instanceof Reconfigurable) - reconfigurableManager.registerReconfigurable("authHandler", (Reconfigurable) config.authHandler); - for (int i = 0; i < config.authProvider.length; ++i) { - AuthProvider provider = config.authProvider[i]; - if (provider instanceof Reconfigurable) - reconfigurableManager.registerReconfigurable("authHandler".concat(String.valueOf(i)), (Reconfigurable) provider); + for (int i = 0; i < config.auth.length; ++i) { + AuthProviderPair pair = config.auth[i]; + if (pair.provider instanceof Reconfigurable) + reconfigurableManager.registerReconfigurable("auth.".concat(pair.name).concat(".provider"), (Reconfigurable) pair.provider); + if (pair.handler instanceof Reconfigurable) + reconfigurableManager.registerReconfigurable("auth.".concat(pair.name).concat(".handler"), (Reconfigurable) pair.handler); } if (config.textureProvider instanceof Reconfigurable) reconfigurableManager.registerReconfigurable("textureProvider", (Reconfigurable) config.textureProvider); @@ -591,10 +616,10 @@ private void generateConfigIfNotExists() throws IOException { newConfig.launch4j.productVer = newConfig.launch4j.fileVer; newConfig.env = LauncherConfig.LauncherEnvironment.STD; newConfig.startScript = JVMHelper.OS_TYPE.equals(JVMHelper.OS.MUSTDIE) ? "." + File.separator + "start.bat" : "." + File.separator + "start.sh"; - newConfig.authHandler = new MemoryAuthHandler(); newConfig.hwidHandler = new AcceptHWIDHandler(); - - newConfig.authProvider = new AuthProvider[]{new RejectAuthProvider("Настройте authProvider")}; + newConfig.auth = new AuthProviderPair[]{ new AuthProviderPair() }; + newConfig.auth[0].provider = new RejectAuthProvider("Настройте authProvider"); + newConfig.auth[0].handler = new MemoryAuthHandler(); newConfig.textureProvider = new RequestTextureProvider("http://example.com/skins/%username%.png", "http://example.com/cloaks/%username%.png"); newConfig.permissionsHandler = new JsonFilePermissionsHandler(); newConfig.port = 7240; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java new file mode 100644 index 00000000..3403e1a6 --- /dev/null +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java @@ -0,0 +1,24 @@ +package ru.gravit.launchserver.auth; + +import ru.gravit.launchserver.auth.handler.AuthHandler; +import ru.gravit.launchserver.auth.provider.AuthProvider; + +import java.io.IOException; + +public class AuthProviderPair { + public AuthProvider provider; + public AuthHandler handler; + public String name; + public boolean isDefault; + + public void init() + { + provider.init(); + handler.init(); + } + + public void close() throws IOException { + provider.close(); + handler.close(); + } +} diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AuthProvider.java index 6883f636..f5d53b06 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AuthProvider.java @@ -36,10 +36,6 @@ public static void registerProviders() { } } - public AuthHandler getAccociateHandler(int this_position) { - return LaunchServer.server.config.authHandler; - } - public abstract AuthProviderResult auth(String login, String password, String ip) throws Exception; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/AuthCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/AuthCommand.java index 5a34131e..124893cd 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/AuthCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/AuthCommand.java @@ -1,6 +1,7 @@ package ru.gravit.launchserver.command.auth; import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.auth.provider.AuthProvider; import ru.gravit.launchserver.auth.provider.AuthProviderResult; import ru.gravit.launchserver.command.Command; @@ -15,7 +16,7 @@ public AuthCommand(LaunchServer server) { @Override public String getArgsDescription() { - return " "; + return " "; } @Override @@ -26,15 +27,20 @@ public String getUsageDescription() { @Override public void invoke(String... args) throws Exception { verifyArgs(args, 2); + AuthProviderPair pair; + if(args.length > 2) pair = server.config.getAuthProviderPair(args[2]); + else pair = server.config.getAuthProviderPair(); + if(pair == null) throw new IllegalStateException(String.format("Auth %s not found", args[1])); + String login = args[0]; String password = args[1]; int auth_id = 0; if (args.length >= 3) auth_id = Integer.valueOf(args[3]); // Authenticate - AuthProvider provider = server.config.authProvider[auth_id]; + AuthProvider provider = pair.provider; AuthProviderResult result = provider.auth(login, password, "127.0.0.1"); - UUID uuid = provider.getAccociateHandler(auth_id).auth(result); + UUID uuid = pair.handler.auth(result); // Print auth successful message LogHelper.subInfo("UUID: %s, Username: '%s', Access Token: '%s'", uuid, result.username, result.accessToken); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/UUIDToUsernameCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/UUIDToUsernameCommand.java index 75f7e774..3a33d05e 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/UUIDToUsernameCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/UUIDToUsernameCommand.java @@ -1,6 +1,7 @@ package ru.gravit.launchserver.command.auth; import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.command.Command; import ru.gravit.utils.command.CommandException; import ru.gravit.utils.helper.LogHelper; @@ -15,7 +16,7 @@ public UUIDToUsernameCommand(LaunchServer server) { @Override public String getArgsDescription() { - return ""; + return " "; } @Override @@ -26,10 +27,15 @@ public String getUsageDescription() { @Override public void invoke(String... args) throws CommandException, IOException { verifyArgs(args, 1); + AuthProviderPair pair; + if(args.length > 1) pair = server.config.getAuthProviderPair(args[1]); + else pair = server.config.getAuthProviderPair(); + if(pair == null) throw new IllegalStateException(String.format("Auth %s not found", args[1])); + UUID uuid = parseUUID(args[0]); // Get UUID by username - String username = server.config.authHandler.uuidToUsername(uuid); + String username = pair.handler.uuidToUsername(uuid); if (username == null) throw new CommandException("Unknown UUID: " + uuid); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/UsernameToUUIDCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/UsernameToUUIDCommand.java index ac3afaad..c1cdd9cc 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/UsernameToUUIDCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/UsernameToUUIDCommand.java @@ -1,6 +1,7 @@ package ru.gravit.launchserver.command.auth; import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.command.Command; import ru.gravit.utils.command.CommandException; import ru.gravit.utils.helper.LogHelper; @@ -15,7 +16,7 @@ public UsernameToUUIDCommand(LaunchServer server) { @Override public String getArgsDescription() { - return ""; + return " "; } @Override @@ -26,10 +27,14 @@ public String getUsageDescription() { @Override public void invoke(String... args) throws CommandException, IOException { verifyArgs(args, 1); + AuthProviderPair pair; + if(args.length > 1) pair = server.config.getAuthProviderPair(args[1]); + else pair = server.config.getAuthProviderPair(); + if(pair == null) throw new IllegalStateException(String.format("Auth %s not found", args[1])); String username = parseUsername(args[0]); // Get UUID by username - UUID uuid = server.config.authHandler.usernameToUUID(username); + UUID uuid = pair.handler.usernameToUUID(username); if (uuid == null) throw new CommandException(String.format("Unknown username: '%s'", username)); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java index 2946fec7..498894df 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java @@ -1,6 +1,7 @@ package ru.gravit.launchserver.command.dump; import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.auth.handler.CachedAuthHandler; import ru.gravit.launchserver.command.Command; import ru.gravit.utils.helper.IOHelper; @@ -19,7 +20,7 @@ public DumpEntryCacheCommand(LaunchServer server) { @Override public String getArgsDescription() { - return "[load/unload] [filename]"; + return "[load/unload] [auth_id] [filename]"; } @Override @@ -29,12 +30,14 @@ public String getUsageDescription() { @Override public void invoke(String... args) throws Exception { - verifyArgs(args, 2); - if (!(server.config.authHandler instanceof CachedAuthHandler)) + verifyArgs(args, 3); + AuthProviderPair pair = server.config.getAuthProviderPair(args[1]); + if(pair == null) throw new IllegalStateException(String.format("Auth %s not found", args[1])); + if (!(pair.handler instanceof CachedAuthHandler)) throw new UnsupportedOperationException("This command used only CachedAuthHandler"); - CachedAuthHandler authHandler = (CachedAuthHandler) server.config.authHandler; + CachedAuthHandler authHandler = (CachedAuthHandler) pair.handler; if (args[0].equals("unload")) { - LogHelper.info("CachedAuthHandler write to %s", args[1]); + LogHelper.info("CachedAuthHandler write to %s", args[2]); Map entryCache = authHandler.getEntryCache(); Map usernamesCache = authHandler.getUsernamesCache(); EntryAndUsername serializable = new EntryAndUsername(); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/handler/CommandHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/handler/CommandHandler.java index d92c4b2c..85d4fc03 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/handler/CommandHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/handler/CommandHandler.java @@ -72,7 +72,6 @@ public static void registerCommands(ru.gravit.utils.command.CommandHandler handl handler.registerCommand("config", new ConfigCommand(server)); handler.registerCommand("configHelp", new ConfigHelpCommand(server)); handler.registerCommand("configList", new ConfigListCommand(server)); - handler.registerCommand("swapAuthProvider", new SwapAuthProviderCommand(server)); handler.registerCommand("serverStatus", new ServerStatusCommand(server)); handler.registerCommand("checkInstall", new CheckInstallCommand(server)); handler.registerCommand("multi", new MultiCommand(server)); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ServerStatusCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ServerStatusCommand.java index 960300cb..1783578a 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ServerStatusCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ServerStatusCommand.java @@ -1,6 +1,7 @@ package ru.gravit.launchserver.command.service; import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.auth.handler.CachedAuthHandler; import ru.gravit.launchserver.command.Command; import ru.gravit.utils.helper.JVMHelper; @@ -33,8 +34,12 @@ public void invoke(String... args) { LogHelper.info("Uptime: %d days %d hours %d minutes %d seconds", days, hour, min, second); LogHelper.info("Uptime (double): %f", (double) JVMHelper.RUNTIME_MXBEAN.getUptime() / 1000); LogHelper.info("Sessions: %d | Modules: %d | Commands: %d", server.sessionManager.getSessions().size(), server.modulesManager.modules.size(), server.commandHandler.commandsMap().size()); - if (server.config.authHandler instanceof CachedAuthHandler) { - LogHelper.info("AuthHandler: EntryCache: %d | usernameCache: %d", ((CachedAuthHandler) server.config.authHandler).getEntryCache().size(), ((CachedAuthHandler) server.config.authHandler).getUsernamesCache().size()); + for(AuthProviderPair pair : server.config.auth) + { + if (pair.handler instanceof CachedAuthHandler) { + LogHelper.info("AuthHandler %s: EntryCache: %d | usernameCache: %d", pair.name, ((CachedAuthHandler) pair.handler).getEntryCache().size(), ((CachedAuthHandler) pair.handler).getUsernamesCache().size()); + } } + } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/SwapAuthProviderCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/SwapAuthProviderCommand.java deleted file mode 100644 index 34828895..00000000 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/SwapAuthProviderCommand.java +++ /dev/null @@ -1,63 +0,0 @@ -package ru.gravit.launchserver.command.service; - -import ru.gravit.launchserver.LaunchServer; -import ru.gravit.launchserver.auth.provider.AcceptAuthProvider; -import ru.gravit.launchserver.auth.provider.AuthProvider; -import ru.gravit.launchserver.auth.provider.RejectAuthProvider; -import ru.gravit.launchserver.command.Command; -import ru.gravit.utils.helper.LogHelper; - -public class SwapAuthProviderCommand extends Command { - public AuthProvider[] providersCache; - - public SwapAuthProviderCommand(LaunchServer server) { - super(server); - } - - @Override - public String getArgsDescription() { - return "[index] [accept/reject/undo] [message(for reject)]"; - } - - @Override - public String getUsageDescription() { - return "Change authProvider"; - } - - @SuppressWarnings("resource") - @Override - public void invoke(String... args) throws Exception { - verifyArgs(args, 2); - if (providersCache == null) providersCache = new AuthProvider[server.config.authProvider.length]; - int index = Integer.valueOf(args[0]); - switch (args[1]) { - case "accept": - if (providersCache[index] == null) { - AcceptAuthProvider provider = new AcceptAuthProvider(); - providersCache[index] = server.config.authProvider[index]; - server.config.authProvider[index] = provider; - LogHelper.info("AuthProvider[%d] is AcceptAuthProvider", index); - } else LogHelper.error("Changes detected. Use undo"); - break; - case "reject": - if (providersCache[index] == null) { - RejectAuthProvider rejectAuthProvider; - if (args.length < 3) rejectAuthProvider = new RejectAuthProvider(); - else rejectAuthProvider = new RejectAuthProvider(args[2]); - providersCache[index] = server.config.authProvider[index]; - server.config.authProvider[index] = rejectAuthProvider; - LogHelper.info("AuthProvider[%d] is RejectAuthProvider", index); - } else LogHelper.error("Changes detected. Use undo"); - break; - case "undo": - if (providersCache[index] == null) LogHelper.error("Cache clean. Undo impossible"); - else { - server.config.authProvider[index].close(); - server.config.authProvider[index] = providersCache[index]; - providersCache[index] = null; - } - - break; - } - } -} diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java index 20a6ff60..3eeb5ae6 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java @@ -7,6 +7,7 @@ import ru.gravit.launcher.serialize.SerializeLimits; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.auth.AuthException; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.auth.hwid.HWIDException; import ru.gravit.launchserver.auth.provider.AuthProvider; import ru.gravit.launchserver.auth.provider.AuthProviderResult; @@ -62,9 +63,8 @@ public void reply() throws Exception { String client = null; if (isClient) client = input.readString(SerializeLimits.MAX_CLIENT); - int auth_id = input.readInt(); + String auth_id = input.readString(SerializeLimits.MAX_QUEUE_SIZE); String hwid_str = input.readString(SerializeLimits.MAX_HWID_STR); - if (auth_id + 1 > server.config.authProvider.length || auth_id < 0) auth_id = 0; byte[] encryptedPassword = input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH); String customText = input.readString(SerializeLimits.MAX_CUSTOM_TEXT); // Decrypt password @@ -80,7 +80,11 @@ public void reply() throws Exception { // Authenticate debug("Login: '%s', Password: '%s'", login, echo(password.length())); AuthProviderResult result; - AuthProvider provider = server.config.authProvider[auth_id]; + AuthProviderPair pair; + if(auth_id.isEmpty()) pair = server.config.getAuthProviderPair(); + else pair = server.config.getAuthProviderPair(auth_id); + if(pair == null) requestError("Auth type not found"); + AuthProvider provider = pair.provider; clientData.type = Client.Type.USER; AuthContext context = new AuthContext(session, login, password.length(), customText, client, hwid_str, false); try { @@ -127,10 +131,12 @@ public void reply() throws Exception { clientData.isAuth = true; clientData.permissions = result.permissions; clientData.username = result.username; + clientData.auth_id = auth_id; + clientData.updateAuth(); // Authenticate on server (and get UUID) UUID uuid; try { - uuid = server.config.authHandler.auth(result); + uuid = pair.handler.auth(result); } catch (AuthException e) { requestError(e.getMessage()); return; 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 66ce8cce..87cf5efd 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 @@ -6,6 +6,7 @@ import ru.gravit.launcher.serialize.SerializeLimits; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.auth.AuthException; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.auth.hwid.HWIDException; import ru.gravit.launchserver.auth.provider.AuthProvider; import ru.gravit.launchserver.auth.provider.AuthProviderResult; @@ -36,8 +37,7 @@ public AuthServerResponse(LaunchServer server, long session, HInput input, HOutp public void reply() throws Exception { String login = input.readString(SerializeLimits.MAX_LOGIN); String client = input.readString(SerializeLimits.MAX_CLIENT); - int auth_id = input.readInt(); - if (auth_id + 1 > server.config.authProvider.length || auth_id < 0) auth_id = 0; + String auth_id = input.readString(SerializeLimits.MAX_QUEUE_SIZE); byte[] encryptedPassword = input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH); // Decrypt password String password; @@ -51,7 +51,11 @@ public void reply() throws Exception { // Authenticate debug("ServerLogin: '%s', Password: '%s'", login, echo(password.length())); AuthProviderResult result; - AuthProvider provider = server.config.authProvider[auth_id]; + AuthProviderPair pair; + if(auth_id.isEmpty()) pair = server.config.getAuthProviderPair(); + else pair = server.config.getAuthProviderPair(auth_id); + if(pair == null) requestError("Auth type not found"); + AuthProvider provider = pair.provider; try { if (server.limiter.isLimit(ip)) { AuthProvider.authError(server.config.authRejectString); @@ -87,6 +91,8 @@ public void reply() throws Exception { } debug("ServerAuth: '%s' -> '%s', '%s'", login, result.username, result.accessToken); clientData.isAuth = true; + clientData.auth_id = auth_id; + clientData.updateAuth(); writeNoError(output); clientData.permissions.write(output); } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/CheckServerResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/CheckServerResponse.java index 002e381d..7638242d 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/CheckServerResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/CheckServerResponse.java @@ -34,7 +34,7 @@ public void reply() throws IOException { UUID uuid; try { server.authHookManager.checkServerHook(username, serverID); - uuid = server.config.authHandler.checkServer(username, serverID); + uuid = clientData.auth.handler.checkServer(username, serverID); } catch (AuthException e) { requestError(e.getMessage()); return; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/JoinServerResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/JoinServerResponse.java index 27e16ebf..521a908e 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/JoinServerResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/JoinServerResponse.java @@ -33,7 +33,7 @@ public void reply() throws IOException { boolean success; try { server.authHookManager.joinServerHook(username, accessToken, serverID); - success = server.config.authHandler.joinServer(username, accessToken, serverID); + success = clientData.auth.handler.joinServer(username, accessToken, serverID); } catch (AuthException e) { requestError(e.getMessage()); return; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/BatchProfileByUsernameResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/BatchProfileByUsernameResponse.java index ca444257..ef0a45f0 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/BatchProfileByUsernameResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/BatchProfileByUsernameResponse.java @@ -30,6 +30,6 @@ public void reply() throws IOException { // Respond with profiles array for (int i = 0; i < usernames.length; i++) - ProfileByUsernameResponse.writeProfile(server, output, usernames[i], clients[i]); + ProfileByUsernameResponse.writeProfile(server, output, usernames[i], clients[i], clientData.auth.handler); } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUUIDResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUUIDResponse.java index 2d636be5..b683fa51 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUUIDResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUUIDResponse.java @@ -48,7 +48,7 @@ public void reply() throws IOException { debug("UUID: " + uuid); String client = input.readString(SerializeLimits.MAX_CLIENT); // Verify has such profile - String username = server.config.authHandler.uuidToUsername(uuid); + String username = clientData.auth.handler.uuidToUsername(uuid); if (username == null) { output.writeBoolean(false); return; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUsernameResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUsernameResponse.java index 043418b5..2d63fd68 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUsernameResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUsernameResponse.java @@ -4,6 +4,7 @@ import ru.gravit.launcher.serialize.HOutput; import ru.gravit.launcher.serialize.SerializeLimits; import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.auth.handler.AuthHandler; import ru.gravit.launchserver.response.Response; import ru.gravit.launchserver.socket.Client; import ru.gravit.utils.helper.VerifyHelper; @@ -13,8 +14,8 @@ public final class ProfileByUsernameResponse extends Response { - public static void writeProfile(LaunchServer server, HOutput output, String username, String client) throws IOException { - UUID uuid = server.config.authHandler.usernameToUUID(username); + public static void writeProfile(LaunchServer server, HOutput output, String username, String client, AuthHandler handler) throws IOException { + UUID uuid = handler.usernameToUUID(username); if (uuid == null) { output.writeBoolean(false); return; @@ -35,6 +36,6 @@ public void reply() throws IOException { debug("Username: " + username); String client = input.readString(SerializeLimits.MAX_CLIENT); // Write response - writeProfile(server, output, username, client); + writeProfile(server, output, username, client, clientData.auth.handler); } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/Client.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/Client.java index 81ca8be4..9db84f43 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/Client.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/Client.java @@ -2,11 +2,13 @@ import ru.gravit.launcher.ClientPermissions; import ru.gravit.launcher.profiles.ClientProfile; +import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.utils.helper.LogHelper; public class Client { public long session; - + public String auth_id; public long timestamp; public Type type; public ClientProfile profile; @@ -16,6 +18,8 @@ public class Client { public String username; public LogHelper.OutputEnity logOutput; + public transient AuthProviderPair auth; + public Client(long session) { this.session = session; timestamp = System.currentTimeMillis(); @@ -26,10 +30,16 @@ public Client(long session) { checkSign = false; } - //Данные ваторизации + //Данные авторизации public void up() { timestamp = System.currentTimeMillis(); } + public void updateAuth() + { + if(!isAuth) return; + if(auth_id.isEmpty()) auth = LaunchServer.server.config.getAuthProviderPair(); + else auth = LaunchServer.server.config.getAuthProviderPair(auth_id); + } public enum Type { SERVER, diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java index 65aae7e9..88371df9 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java @@ -7,6 +7,7 @@ import ru.gravit.launcher.profiles.ClientProfile; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.auth.AuthException; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.auth.hwid.HWIDException; import ru.gravit.launchserver.auth.provider.AuthProvider; import ru.gravit.launchserver.auth.provider.AuthProviderResult; @@ -31,14 +32,14 @@ public class AuthResponse implements JsonResponseInterface { public String password; public byte[] encryptedPassword; - public AuthResponse(String login, String password, int authid, OshiHWID hwid) { + public AuthResponse(String login, String password, String auth_id, OshiHWID hwid) { this.login = login; this.password = password; - this.authid = authid; + this.auth_id = auth_id; this.hwid = hwid; } - public int authid; + public String auth_id; public ConnectTypes authType; public OshiHWID hwid; public enum ConnectTypes @@ -82,8 +83,11 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client { AuthProvider.authError("authType: SERVER not allowed for this account"); } + AuthProviderPair pair; + if(auth_id.isEmpty()) pair = LaunchServer.server.config.getAuthProviderPair(); + else pair = LaunchServer.server.config.getAuthProviderPair(auth_id); ru.gravit.launchserver.response.auth.AuthResponse.AuthContext context = new ru.gravit.launchserver.response.auth.AuthResponse.AuthContext(0, login, password.length(),customText, client, null, false); - AuthProvider provider = LaunchServer.server.config.authProvider[authid]; + AuthProvider provider = pair.provider; LaunchServer.server.authHookManager.preHook(context, clientData); provider.preAuth(login,password,customText,ip); AuthProviderResult aresult = provider.auth(login, password, ip); @@ -103,12 +107,14 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client //if (clientData.profile == null) { // throw new AuthException("You profile not found"); //} - UUID uuid = LaunchServer.server.config.authHandler.auth(aresult); + UUID uuid = pair.handler.auth(aresult); if(authType == ConnectTypes.CLIENT) LaunchServer.server.config.hwidHandler.check(hwid, aresult.username); LaunchServer.server.authHookManager.postHook(context, clientData); clientData.isAuth = true; clientData.permissions = aresult.permissions; + clientData.auth_id = auth_id; + clientData.updateAuth(); result.accessToken = aresult.accessToken; result.permissions = clientData.permissions; result.playerProfile = ProfileByUUIDResponse.getProfile(LaunchServer.server,uuid,aresult.username,client); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/CheckServerResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/CheckServerResponse.java index 80a13120..2e07a30c 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/CheckServerResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/CheckServerResponse.java @@ -25,7 +25,7 @@ public String getType() { public void execute(WebSocketService service, ChannelHandlerContext ctx, Client pClient) { CheckServerRequestEvent result = new CheckServerRequestEvent(); try { - result.uuid = LaunchServer.server.config.authHandler.checkServer(username, serverID); + result.uuid = pClient.auth.handler.checkServer(username, serverID); if(result.uuid != null) result.playerProfile = ProfileByUUIDResponse.getProfile(LaunchServer.server,result.uuid,username,client); } catch (AuthException e) { diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/JoinServerResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/JoinServerResponse.java index 85aa3dd7..d94bef47 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/JoinServerResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/JoinServerResponse.java @@ -24,7 +24,7 @@ public String getType() { public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) { boolean success; try { - success = LaunchServer.server.config.authHandler.joinServer(username, accessToken, serverID); + success = client.auth.handler.joinServer(username, accessToken, serverID); } catch (AuthException e) { service.sendObject(ctx, new ErrorRequestEvent(e.getMessage())); return; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java index 22fade29..477e8e95 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java @@ -28,7 +28,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client result.playerProfiles = new PlayerProfile[list.length]; for(int i=0;i Date: Fri, 22 Mar 2019 11:08:21 +0700 Subject: [PATCH 3/8] =?UTF-8?q?[FIX]=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=B0?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/ru/gravit/launchserver/LaunchServer.java | 4 +--- .../ru/gravit/launchserver/auth/AuthProviderPair.java | 8 +++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index 8a1b6e5a..6a353e9a 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -617,9 +617,7 @@ private void generateConfigIfNotExists() throws IOException { newConfig.env = LauncherConfig.LauncherEnvironment.STD; newConfig.startScript = JVMHelper.OS_TYPE.equals(JVMHelper.OS.MUSTDIE) ? "." + File.separator + "start.bat" : "." + File.separator + "start.sh"; newConfig.hwidHandler = new AcceptHWIDHandler(); - newConfig.auth = new AuthProviderPair[]{ new AuthProviderPair() }; - newConfig.auth[0].provider = new RejectAuthProvider("Настройте authProvider"); - newConfig.auth[0].handler = new MemoryAuthHandler(); + newConfig.auth = new AuthProviderPair[]{ new AuthProviderPair(new RejectAuthProvider("Настройте authProvider"), new MemoryAuthHandler(), "std") }; newConfig.textureProvider = new RequestTextureProvider("http://example.com/skins/%username%.png", "http://example.com/cloaks/%username%.png"); newConfig.permissionsHandler = new JsonFilePermissionsHandler(); newConfig.port = 7240; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java index 3403e1a6..38e45f4e 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java @@ -9,7 +9,13 @@ public class AuthProviderPair { public AuthProvider provider; public AuthHandler handler; public String name; - public boolean isDefault; + public boolean isDefault = true; + + public AuthProviderPair(AuthProvider provider, AuthHandler handler, String name) { + this.provider = provider; + this.handler = handler; + this.name = name; + } public void init() { From 421fa07317f4e2c9e1129daf0d9efd14e4edd4de Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 22 Mar 2019 11:10:40 +0700 Subject: [PATCH 4/8] =?UTF-8?q?[FIX]=20=D0=B1=D1=80=D0=B0=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0=20=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=20=D0=B2=20Reload=20=D0=B8=20Reconfigurable?= =?UTF-8?q?=20=D0=BC=D0=B5=D0=BD=D0=B5=D0=B4=D0=B6=D0=B5=D1=80=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ru/gravit/launchserver/manangers/ReconfigurableManager.java | 1 - .../java/ru/gravit/launchserver/manangers/ReloadManager.java | 1 - 2 files changed, 2 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReconfigurableManager.java b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReconfigurableManager.java index 4805f590..56ab43f0 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReconfigurableManager.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReconfigurableManager.java @@ -11,7 +11,6 @@ public class ReconfigurableManager { private final HashMap RECONFIGURABLE = new HashMap<>(); public void registerReconfigurable(String name, Reconfigurable reconfigurable) { - VerifyHelper.verifyIDName(name); VerifyHelper.putIfAbsent(RECONFIGURABLE, name, Objects.requireNonNull(reconfigurable, "adapter"), String.format("Reloadable has been already registered: '%s'", name)); } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReloadManager.java b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReloadManager.java index b57f0f17..33eb7872 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReloadManager.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReloadManager.java @@ -11,7 +11,6 @@ public class ReloadManager { private final HashMap RELOADABLES = new HashMap<>(); public void registerReloadable(String name, Reloadable reloadable) { - VerifyHelper.verifyIDName(name); VerifyHelper.putIfAbsent(RELOADABLES, name, Objects.requireNonNull(reloadable, "adapter"), String.format("Reloadable has been already registered: '%s'", name)); } From 5f252682f3d5a1788c0b1d46463f9e22fed8f193 Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 22 Mar 2019 11:36:06 +0700 Subject: [PATCH 5/8] =?UTF-8?q?[FEATURE]=20textureProvider=20=D0=B2=D0=BD?= =?UTF-8?q?=D0=B5=D1=81=D0=B5=D0=BD=20=D0=B2=20AuthProviderPair?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ru/gravit/launchserver/LaunchServer.java | 24 +++++++------------ .../launchserver/auth/AuthProviderPair.java | 6 ++++- .../response/auth/AuthResponse.java | 2 +- .../response/auth/CheckServerResponse.java | 2 +- .../BatchProfileByUsernameResponse.java | 2 +- .../profile/ProfileByUUIDResponse.java | 9 +++---- .../profile/ProfileByUsernameResponse.java | 9 +++---- .../websocket/json/auth/AuthResponse.java | 2 +- .../json/auth/CheckServerResponse.java | 2 +- .../json/profile/BatchProfileByUsername.java | 2 +- .../json/profile/ProfileByUUIDResponse.java | 9 +++---- .../json/profile/ProfileByUsername.java | 2 +- 12 files changed, 35 insertions(+), 36 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index 6a353e9a..da369875 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -113,8 +113,6 @@ public AuthProviderPair getAuthProviderPair() public PermissionsHandler permissionsHandler; - public TextureProvider textureProvider; - public HWIDHandler hwidHandler; // Misc options @@ -202,9 +200,6 @@ public void verify() { { throw new IllegalStateException("No auth pairs declared by default."); } - if (textureProvider == null) { - throw new NullPointerException("TextureProvider must not be null"); - } if (permissionsHandler == null) { throw new NullPointerException("PermissionsHandler must not be null"); } @@ -223,11 +218,6 @@ public void close() } catch (IOException e) { LogHelper.error(e); } - try { - textureProvider.close(); - } catch (IOException e) { - LogHelper.error(e); - } try { hwidHandler.close(); } catch (Exception e) { @@ -494,9 +484,9 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE reloadManager.registerReloadable("auth.".concat(pair.name).concat(".provider"), (Reloadable) pair.provider); if (pair.handler instanceof Reloadable) reloadManager.registerReloadable("auth.".concat(pair.name).concat(".handler"), (Reloadable) pair.handler); + if (pair.textureProvider instanceof Reloadable) + reloadManager.registerReloadable("auth.".concat(pair.name).concat(".texture"), (Reloadable) pair.textureProvider); } - if (config.textureProvider instanceof Reloadable) - reloadManager.registerReloadable("textureProvider", (Reloadable) config.textureProvider); Arrays.stream(config.mirrors).forEach(mirrorManager::addMirror); @@ -508,9 +498,9 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE reconfigurableManager.registerReconfigurable("auth.".concat(pair.name).concat(".provider"), (Reconfigurable) pair.provider); if (pair.handler instanceof Reconfigurable) reconfigurableManager.registerReconfigurable("auth.".concat(pair.name).concat(".handler"), (Reconfigurable) pair.handler); + if (pair.textureProvider instanceof Reconfigurable) + reconfigurableManager.registerReconfigurable("auth.".concat(pair.name).concat(".texture"), (Reconfigurable) pair.textureProvider); } - if (config.textureProvider instanceof Reconfigurable) - reconfigurableManager.registerReconfigurable("textureProvider", (Reconfigurable) config.textureProvider); Arrays.stream(config.mirrors).forEach(mirrorManager::addMirror); @@ -617,8 +607,10 @@ private void generateConfigIfNotExists() throws IOException { newConfig.env = LauncherConfig.LauncherEnvironment.STD; newConfig.startScript = JVMHelper.OS_TYPE.equals(JVMHelper.OS.MUSTDIE) ? "." + File.separator + "start.bat" : "." + File.separator + "start.sh"; newConfig.hwidHandler = new AcceptHWIDHandler(); - newConfig.auth = new AuthProviderPair[]{ new AuthProviderPair(new RejectAuthProvider("Настройте authProvider"), new MemoryAuthHandler(), "std") }; - newConfig.textureProvider = new RequestTextureProvider("http://example.com/skins/%username%.png", "http://example.com/cloaks/%username%.png"); + newConfig.auth = new AuthProviderPair[]{ new AuthProviderPair(new RejectAuthProvider("Настройте authProvider"), + new MemoryAuthHandler(), + new RequestTextureProvider("http://example.com/skins/%username%.png", "http://example.com/cloaks/%username%.png") + , "std") }; newConfig.permissionsHandler = new JsonFilePermissionsHandler(); newConfig.port = 7240; newConfig.bindAddress = "0.0.0.0"; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java index 38e45f4e..b617f9e5 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/AuthProviderPair.java @@ -2,18 +2,21 @@ import ru.gravit.launchserver.auth.handler.AuthHandler; import ru.gravit.launchserver.auth.provider.AuthProvider; +import ru.gravit.launchserver.texture.TextureProvider; import java.io.IOException; public class AuthProviderPair { public AuthProvider provider; public AuthHandler handler; + public TextureProvider textureProvider; public String name; public boolean isDefault = true; - public AuthProviderPair(AuthProvider provider, AuthHandler handler, String name) { + public AuthProviderPair(AuthProvider provider, AuthHandler handler, TextureProvider textureProvider, String name) { this.provider = provider; this.handler = handler; + this.textureProvider = textureProvider; this.name = name; } @@ -26,5 +29,6 @@ public void init() public void close() throws IOException { provider.close(); handler.close(); + textureProvider.close(); } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java index 3eeb5ae6..f115ee28 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/AuthResponse.java @@ -147,7 +147,7 @@ public void reply() throws Exception { } writeNoError(output); // Write profile and UUID - ProfileByUUIDResponse.getProfile(server, uuid, result.username, client).write(output); + ProfileByUUIDResponse.getProfile(server, uuid, result.username, client, clientData.auth.textureProvider).write(output); output.writeASCII(result.accessToken, -SecurityHelper.TOKEN_STRING_LENGTH); clientData.permissions.write(output); } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/CheckServerResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/CheckServerResponse.java index 7638242d..51b10fd5 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/CheckServerResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/auth/CheckServerResponse.java @@ -48,6 +48,6 @@ public void reply() throws IOException { // Write profile and UUID output.writeBoolean(uuid != null); if (uuid != null) - ProfileByUUIDResponse.getProfile(server, uuid, username, client).write(output); + ProfileByUUIDResponse.getProfile(server, uuid, username, client, clientData.auth.textureProvider).write(output); } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/BatchProfileByUsernameResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/BatchProfileByUsernameResponse.java index ef0a45f0..9981a8bf 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/BatchProfileByUsernameResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/BatchProfileByUsernameResponse.java @@ -30,6 +30,6 @@ public void reply() throws IOException { // Respond with profiles array for (int i = 0; i < usernames.length; i++) - ProfileByUsernameResponse.writeProfile(server, output, usernames[i], clients[i], clientData.auth.handler); + ProfileByUsernameResponse.writeProfile(server, output, usernames[i], clients[i], clientData.auth); } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUUIDResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUUIDResponse.java index b683fa51..3227efe4 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUUIDResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUUIDResponse.java @@ -8,6 +8,7 @@ import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.response.Response; import ru.gravit.launchserver.socket.Client; +import ru.gravit.launchserver.texture.TextureProvider; import ru.gravit.utils.helper.LogHelper; import java.io.IOException; @@ -15,11 +16,11 @@ public final class ProfileByUUIDResponse extends Response { - public static PlayerProfile getProfile(LaunchServer server, UUID uuid, String username, String client) { + public static PlayerProfile getProfile(LaunchServer server, UUID uuid, String username, String client, TextureProvider textureProvider) { // Get skin texture Texture skin; try { - skin = server.config.textureProvider.getSkinTexture(uuid, username, client); + skin = textureProvider.getSkinTexture(uuid, username, client); } catch (IOException e) { LogHelper.error(new IOException(String.format("Can't get skin texture: '%s'", username), e)); skin = null; @@ -28,7 +29,7 @@ public static PlayerProfile getProfile(LaunchServer server, UUID uuid, String us // Get cloak texture Texture cloak; try { - cloak = server.config.textureProvider.getCloakTexture(uuid, username, client); + cloak = textureProvider.getCloakTexture(uuid, username, client); } catch (IOException e) { LogHelper.error(new IOException(String.format("Can't get cloak texture: '%s'", username), e)); cloak = null; @@ -56,6 +57,6 @@ public void reply() throws IOException { // Write profile output.writeBoolean(true); - getProfile(server, uuid, username, client).write(output); + getProfile(server, uuid, username, client, clientData.auth.textureProvider).write(output); } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUsernameResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUsernameResponse.java index 2d63fd68..d09468b2 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUsernameResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/response/profile/ProfileByUsernameResponse.java @@ -4,6 +4,7 @@ import ru.gravit.launcher.serialize.HOutput; import ru.gravit.launcher.serialize.SerializeLimits; import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.auth.handler.AuthHandler; import ru.gravit.launchserver.response.Response; import ru.gravit.launchserver.socket.Client; @@ -14,8 +15,8 @@ public final class ProfileByUsernameResponse extends Response { - public static void writeProfile(LaunchServer server, HOutput output, String username, String client, AuthHandler handler) throws IOException { - UUID uuid = handler.usernameToUUID(username); + public static void writeProfile(LaunchServer server, HOutput output, String username, String client, AuthProviderPair pair) throws IOException { + UUID uuid = pair.handler.usernameToUUID(username); if (uuid == null) { output.writeBoolean(false); return; @@ -23,7 +24,7 @@ public static void writeProfile(LaunchServer server, HOutput output, String user // Write profile output.writeBoolean(true); - ProfileByUUIDResponse.getProfile(server, uuid, username, client).write(output); + ProfileByUUIDResponse.getProfile(server, uuid, username, client, pair.textureProvider).write(output); } public ProfileByUsernameResponse(LaunchServer server, long session, HInput input, HOutput output, String ip, Client clientData) { @@ -36,6 +37,6 @@ public void reply() throws IOException { debug("Username: " + username); String client = input.readString(SerializeLimits.MAX_CLIENT); // Write response - writeProfile(server, output, username, client, clientData.auth.handler); + writeProfile(server, output, username, client, clientData.auth); } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java index 88371df9..01ed5b1c 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java @@ -117,7 +117,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client clientData.updateAuth(); result.accessToken = aresult.accessToken; result.permissions = clientData.permissions; - result.playerProfile = ProfileByUUIDResponse.getProfile(LaunchServer.server,uuid,aresult.username,client); + result.playerProfile = ProfileByUUIDResponse.getProfile(LaunchServer.server,uuid,aresult.username,client, clientData.auth.textureProvider); service.sendObject(ctx, result); } catch (AuthException | HWIDException e) { service.sendObject(ctx, new ErrorRequestEvent(e.getMessage())); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/CheckServerResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/CheckServerResponse.java index 2e07a30c..46c1bdfc 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/CheckServerResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/CheckServerResponse.java @@ -27,7 +27,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client try { result.uuid = pClient.auth.handler.checkServer(username, serverID); if(result.uuid != null) - result.playerProfile = ProfileByUUIDResponse.getProfile(LaunchServer.server,result.uuid,username,client); + result.playerProfile = ProfileByUUIDResponse.getProfile(LaunchServer.server,result.uuid,username,client, pClient.auth.textureProvider); } catch (AuthException e) { service.sendObject(ctx, new ErrorRequestEvent(e.getMessage())); return; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java index 477e8e95..c3945080 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java @@ -29,7 +29,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client for(int i=0;i Date: Fri, 22 Mar 2019 11:40:49 +0700 Subject: [PATCH 6/8] =?UTF-8?q?[FIX]=20=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20Request=20=D1=87=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D0=B8=20=D0=B8=20=D1=84=D0=B8=D0=BA=D1=81=20ServerWrappe?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../launcher/request/auth/AuthRequest.java | 21 ++++++------------- .../request/auth/AuthServerRequest.java | 12 +++++------ .../gravit/launcher/server/ServerWrapper.java | 3 ++- 3 files changed, 14 insertions(+), 22 deletions(-) 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; } From 4ea62e5e229741000d8594987bd8a7d0ea98b588 Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 22 Mar 2019 12:50:40 +0700 Subject: [PATCH 7/8] =?UTF-8?q?[ANY]=20=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB?= =?UTF-8?q?=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index cbcabd88..073b52f7 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit cbcabd887ec4e671730a3eda6cba777683d6de78 +Subproject commit 073b52f785527e01ca548fc56b71130b41ce648e From 46f584076d12133d78790769763312a33ee57160 Mon Sep 17 00:00:00 2001 From: Gravit Date: Thu, 28 Mar 2019 10:58:21 +0700 Subject: [PATCH 8/8] [ANY] 4.5.0 --- libLauncher/src/main/java/ru/gravit/launcher/Launcher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java b/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java index 18c3c6f2..e54d5414 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java +++ b/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java @@ -59,8 +59,8 @@ public final class Launcher { private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL); public static final int MAJOR = 4; - public static final int MINOR = 4; - public static final int PATCH = 2; + public static final int MINOR = 5; + public static final int PATCH = 0; public static final int BUILD = 1; public static final Version.Type RELEASE = Version.Type.STABLE; public static GsonBuilder gsonBuilder;