From 23a1c9a7e1e3063217b753c0642c60bbae5a840e Mon Sep 17 00:00:00 2001 From: Gravit Date: Sun, 23 Sep 2018 19:07:07 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9C=D1=83=D0=BB=D1=8C=D1=82=D0=B8=20AuthHand?= =?UTF-8?q?ler's?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ru/gravit/launchserver/LaunchServer.java | 15 +++++------ .../auth/provider/AcceptAuthProvider.java | 5 ++-- .../auth/provider/AuthProvider.java | 25 ++++++++++++++----- .../auth/provider/DigestAuthProvider.java | 5 ++-- .../auth/provider/FileAuthProvider.java | 5 ++-- .../auth/provider/JsonAuthProvider.java | 5 ++-- .../auth/provider/MojangAuthProvider.java | 5 ++-- .../auth/provider/MySQLAuthProvider.java | 6 +++-- .../auth/provider/NullAuthProvider.java | 5 ++-- .../auth/provider/RejectAuthProvider.java | 5 ++-- .../auth/provider/RequestAuthProvider.java | 5 ++-- .../command/auth/AuthCommand.java | 8 ++++-- .../command/auth/UUIDToUsernameCommand.java | 2 +- .../command/auth/UsernameToUUIDCommand.java | 2 +- .../response/auth/AuthResponse.java | 4 +-- .../response/auth/CheckServerResponse.java | 2 +- .../response/auth/JoinServerResponse.java | 2 +- .../profile/ProfileByUUIDResponse.java | 2 +- .../profile/ProfileByUsernameResponse.java | 2 +- 19 files changed, 69 insertions(+), 41 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index e3c8a6f1..d8022245 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -73,7 +73,7 @@ public static final class Config extends ConfigObject { // Handlers & Providers @LauncherAPI - public final AuthHandler authHandler; + public final AuthHandler[] authHandler; @LauncherAPI public final AuthProvider[] authProvider; @LauncherAPI @@ -105,7 +105,7 @@ public static final class Config extends ConfigObject { private final StringConfigEntry address; private final String bindAddress; - private Config(BlockConfigEntry block, Path coredir) { + private Config(BlockConfigEntry block, Path coredir,LaunchServer server) { super(block); address = block.getEntry("address", StringConfigEntry.class); port = VerifyHelper.verifyInt(block.getEntryValue("port", IntegerConfigEntry.class), @@ -123,11 +123,12 @@ private Config(BlockConfigEntry block, Path coredir) { // Set handlers & providers - authHandler = AuthHandler.newHandler(block.getEntryValue("authHandler", StringConfigEntry.class), + authHandler = new AuthHandler[1]; + authHandler[0] = AuthHandler.newHandler(block.getEntryValue("authHandler", StringConfigEntry.class), block.getEntry("authHandlerConfig", BlockConfigEntry.class)); authProvider = new AuthProvider[1]; authProvider[0] = AuthProvider.newProvider(block.getEntryValue("authProvider", StringConfigEntry.class), - block.getEntry("authProviderConfig", BlockConfigEntry.class)); + block.getEntry("authProviderConfig", BlockConfigEntry.class),server); textureProvider = TextureProvider.newProvider(block.getEntryValue("textureProvider", StringConfigEntry.class), block.getEntry("textureProviderConfig", BlockConfigEntry.class)); hwidHandler = HWIDHandler.newHandler(block.getEntryValue("hwidHandler", StringConfigEntry.class), @@ -400,7 +401,7 @@ public LaunchServer(Path dir, boolean portable) throws IOException, InvalidKeySp generateConfigIfNotExists(); LogHelper.info("Reading LaunchServer config file"); try (BufferedReader reader = IOHelper.newReader(configFile)) { - config = new Config(TextConfigReader.read(reader, true), dir); + config = new Config(TextConfigReader.read(reader, true), dir,this); } config.verify(); @@ -455,7 +456,7 @@ public void close() { // Close handlers & providers try { - config.authHandler.close(); + for(AuthHandler h : config.authHandler) h.close(); } catch (IOException e) { LogHelper.error(e); } @@ -483,7 +484,7 @@ private void generateConfigIfNotExists() throws IOException { LogHelper.info("Creating LaunchServer config"); Config newConfig; try (BufferedReader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/config.cfg"))) { - newConfig = new Config(TextConfigReader.read(reader, false), dir); + newConfig = new Config(TextConfigReader.read(reader, false), dir,this); } // Set server address diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AcceptAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AcceptAuthProvider.java index 63ac8f98..7f23c7d6 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AcceptAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AcceptAuthProvider.java @@ -1,11 +1,12 @@ package ru.gravit.launchserver.auth.provider; +import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.helper.SecurityHelper; import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry; public final class AcceptAuthProvider extends AuthProvider { - public AcceptAuthProvider(BlockConfigEntry block) { - super(block); + public AcceptAuthProvider(BlockConfigEntry block, LaunchServer server) { + super(block,server); } @Override 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 28de7dda..44519099 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 @@ -6,14 +6,17 @@ import java.util.concurrent.ConcurrentHashMap; import ru.gravit.launcher.LauncherAPI; +import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.auth.handler.AuthHandler; import ru.gravit.utils.helper.VerifyHelper; import ru.gravit.launcher.serialize.config.ConfigObject; import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry; import ru.gravit.launchserver.auth.AuthException; public abstract class AuthProvider extends ConfigObject implements AutoCloseable { - private static final Map> AUTH_PROVIDERS = new ConcurrentHashMap<>(8); + private static final Map> AUTH_PROVIDERS = new ConcurrentHashMap<>(8); private static boolean registredProv = false; + private LaunchServer server; @LauncherAPI public static AuthProviderResult authError(String message) throws AuthException { @@ -21,15 +24,15 @@ public static AuthProviderResult authError(String message) throws AuthException } @LauncherAPI - public static AuthProvider newProvider(String name, BlockConfigEntry block) { + public static AuthProvider newProvider(String name, BlockConfigEntry block,LaunchServer server) { VerifyHelper.verifyIDName(name); - Adapter authHandlerAdapter = VerifyHelper.getMapValue(AUTH_PROVIDERS, name, + ServerAdapter authHandlerAdapter = VerifyHelper.getMapValue(AUTH_PROVIDERS, name, String.format("Unknown auth provider: '%s'", name)); - return authHandlerAdapter.convert(block); + return authHandlerAdapter.convert(block,server); } @LauncherAPI - public static void registerProvider(String name, Adapter adapter) { + public static void registerProvider(String name, ServerAdapter adapter) { VerifyHelper.putIfAbsent(AUTH_PROVIDERS, name, Objects.requireNonNull(adapter, "adapter"), String.format("Auth provider has been already registered: '%s'", name)); } @@ -49,10 +52,15 @@ public static void registerProviders() { registredProv = true; } } + public AuthHandler getAccociateHandler(int this_position) + { + return server.config.authHandler[this_position]; + } @LauncherAPI - protected AuthProvider(BlockConfigEntry block) { + protected AuthProvider(BlockConfigEntry block, LaunchServer launchServer) { super(block); + server = launchServer; } @LauncherAPI @@ -60,4 +68,9 @@ protected AuthProvider(BlockConfigEntry block) { @Override public abstract void close() throws IOException; + @FunctionalInterface + public interface ServerAdapter { + @LauncherAPI + O convert(BlockConfigEntry entry,LaunchServer server); + } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/DigestAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/DigestAuthProvider.java index ecd2688b..c36fa540 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/DigestAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/DigestAuthProvider.java @@ -1,6 +1,7 @@ package ru.gravit.launchserver.auth.provider; import ru.gravit.launcher.LauncherAPI; +import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.helper.SecurityHelper; import ru.gravit.utils.helper.SecurityHelper.DigestAlgorithm; import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry; @@ -11,8 +12,8 @@ public abstract class DigestAuthProvider extends AuthProvider { private final DigestAlgorithm digest; @LauncherAPI - protected DigestAuthProvider(BlockConfigEntry block) { - super(block); + protected DigestAuthProvider(BlockConfigEntry block, LaunchServer server) { + super(block,server); digest = DigestAlgorithm.byName(block.getEntryValue("digest", StringConfigEntry.class)); } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/FileAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/FileAuthProvider.java index b50580f0..899e161c 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/FileAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/FileAuthProvider.java @@ -8,6 +8,7 @@ import java.util.Map; import java.util.Set; +import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.helper.CommonHelper; import ru.gravit.utils.helper.IOHelper; import ru.gravit.utils.helper.LogHelper; @@ -43,8 +44,8 @@ private Entry(BlockConfigEntry block) { private FileTime cacheLastModified; - public FileAuthProvider(BlockConfigEntry block) { - super(block); + public FileAuthProvider(BlockConfigEntry block, LaunchServer server) { + super(block,server); file = IOHelper.toPath(block.getEntryValue("file", StringConfigEntry.class)); // Try to update cache diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/JsonAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/JsonAuthProvider.java index c5a4150b..04e8d8db 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/JsonAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/JsonAuthProvider.java @@ -7,6 +7,7 @@ import com.eclipsesource.json.JsonObject; import com.eclipsesource.json.JsonValue; +import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.HTTPRequest; import ru.gravit.utils.helper.IOHelper; import ru.gravit.utils.helper.SecurityHelper; @@ -25,8 +26,8 @@ public final class JsonAuthProvider extends AuthProvider { private final String responseUserKeyName; private final String responseErrorKeyName; - JsonAuthProvider(BlockConfigEntry block) { - super(block); + JsonAuthProvider(BlockConfigEntry block, LaunchServer server) { + super(block,server); String configUrl = block.getEntryValue("url", StringConfigEntry.class); userKeyName = VerifyHelper.verify(block.getEntryValue("userKeyName", StringConfigEntry.class), VerifyHelper.NOT_EMPTY, "Username key name can't be empty"); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/MojangAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/MojangAuthProvider.java index 9c71ca71..415ed75a 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/MojangAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/MojangAuthProvider.java @@ -16,6 +16,7 @@ import com.eclipsesource.json.JsonValue; import com.eclipsesource.json.WriterConfig; +import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.helper.IOHelper; import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry; @@ -53,8 +54,8 @@ public static JsonObject makeJSONRequest(URL url, JsonObject request) throws IOE } } - public MojangAuthProvider(BlockConfigEntry block) { - super(block); + public MojangAuthProvider(BlockConfigEntry block, LaunchServer server) { + super(block,server); } @Override diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/MySQLAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/MySQLAuthProvider.java index a132bea3..59265d95 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/MySQLAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/MySQLAuthProvider.java @@ -5,6 +5,8 @@ import java.sql.ResultSet; import java.sql.SQLException; +import clojure.lang.IFn; +import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.helper.CommonHelper; import ru.gravit.utils.helper.SecurityHelper; import ru.gravit.utils.helper.VerifyHelper; @@ -19,8 +21,8 @@ public final class MySQLAuthProvider extends AuthProvider { private final String query; private final String[] queryParams; - public MySQLAuthProvider(BlockConfigEntry block) { - super(block); + public MySQLAuthProvider(BlockConfigEntry block, LaunchServer server) { + super(block,server); mySQLHolder = new MySQLSourceConfig("authProviderPool", block); // Read query diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/NullAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/NullAuthProvider.java index 3cab3b07..e424788a 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/NullAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/NullAuthProvider.java @@ -4,14 +4,15 @@ import java.util.Objects; import ru.gravit.launcher.LauncherAPI; +import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.helper.VerifyHelper; import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry; public final class NullAuthProvider extends AuthProvider { private volatile AuthProvider provider; - public NullAuthProvider(BlockConfigEntry block) { - super(block); + public NullAuthProvider(BlockConfigEntry block, LaunchServer server) { + super(block,server); } @Override diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RejectAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RejectAuthProvider.java index bd3f6de4..f8884a45 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RejectAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RejectAuthProvider.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.auth.provider; +import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.helper.VerifyHelper; import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry; import ru.gravit.launcher.serialize.config.entry.StringConfigEntry; @@ -8,8 +9,8 @@ public final class RejectAuthProvider extends AuthProvider { private final String message; - public RejectAuthProvider(BlockConfigEntry block) { - super(block); + public RejectAuthProvider(BlockConfigEntry block, LaunchServer server) { + super(block,server); message = VerifyHelper.verify(block.getEntryValue("message", StringConfigEntry.class), VerifyHelper.NOT_EMPTY, "Auth error message can't be empty"); } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RequestAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RequestAuthProvider.java index 6e5ac57b..3737ab39 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RequestAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RequestAuthProvider.java @@ -5,6 +5,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.helper.CommonHelper; import ru.gravit.utils.helper.IOHelper; import ru.gravit.utils.helper.SecurityHelper; @@ -15,8 +16,8 @@ public final class RequestAuthProvider extends AuthProvider { private final String url; private final Pattern response; - public RequestAuthProvider(BlockConfigEntry block) { - super(block); + public RequestAuthProvider(BlockConfigEntry block, LaunchServer server) { + super(block,server); url = block.getEntryValue("url", StringConfigEntry.class); response = Pattern.compile(block.getEntryValue("response", StringConfigEntry.class)); 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 148afb25..37f173d3 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 @@ -2,6 +2,7 @@ import java.util.UUID; +import ru.gravit.launchserver.auth.provider.AuthProvider; import ru.gravit.utils.helper.LogHelper; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.auth.provider.AuthProviderResult; @@ -27,10 +28,13 @@ public void invoke(String... args) throws Exception { verifyArgs(args, 2); String login = args[0]; String password = args[1]; + int auth_id = 0; + if(args.length >= 3) auth_id = Integer.valueOf(args[3]); // Authenticate - AuthProviderResult result = server.config.authProvider.auth(login, password, "127.0.0.1"); - UUID uuid = server.config.authHandler.auth(result); + AuthProvider provider = server.config.authProvider[auth_id]; + AuthProviderResult result = provider.auth(login, password, "127.0.0.1"); + UUID uuid = provider.getAccociateHandler(auth_id).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 11fac6bd..7efdbf31 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 @@ -29,7 +29,7 @@ public void invoke(String... args) throws CommandException, IOException { UUID uuid = parseUUID(args[0]); // Get UUID by username - String username = server.config.authHandler.uuidToUsername(uuid); + String username = server.config.authHandler[0].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 98b465a0..70652c54 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 @@ -29,7 +29,7 @@ public void invoke(String... args) throws CommandException, IOException { String username = parseUsername(args[0]); // Get UUID by username - UUID uuid = server.config.authHandler.usernameToUUID(username); + UUID uuid = server.config.authHandler[0].usernameToUUID(username); if (uuid == null) throw new CommandException(String.format("Unknown username: '%s'", username)); 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 814c9c34..fa59af7e 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 @@ -59,12 +59,12 @@ public void reply() throws Exception { // Authenticate debug("Login: '%s', Password: '%s'", login, echo(password.length())); AuthProviderResult result; + AuthProvider provider = server.config.authProvider[auth_id]; try { if (server.limiter.isLimit(ip)) { AuthProvider.authError(server.config.authRejectString); return; } - AuthProvider provider = server.config.authProvider[auth_id]; result = provider.auth(login, password, ip); if (!VerifyHelper.isValidUsername(result.username)) { AuthProvider.authError(String.format("Illegal result: '%s'", result.username)); @@ -88,7 +88,7 @@ public void reply() throws Exception { // Authenticate on server (and get UUID) UUID uuid; try { - uuid = server.config.authHandler.auth(result); + uuid = provider.getAccociateHandler(auth_id).auth(result); } catch (AuthException e) { requestError(e.getMessage()); return; 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 6f4b92bd..2e701989 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 @@ -29,7 +29,7 @@ public void reply() throws IOException { // Try check server with auth handler UUID uuid; try { - uuid = server.config.authHandler.checkServer(username, serverID); + uuid = server.config.authHandler[0].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 425f5a34..4036df6e 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 @@ -28,7 +28,7 @@ public void reply() throws IOException { debug("Username: '%s', Access token: %s, Server ID: %s", username, accessToken, serverID); boolean success; try { - success = server.config.authHandler.joinServer(username, accessToken, serverID); + success = server.config.authHandler[0].joinServer(username, accessToken, serverID); } catch (AuthException e) { requestError(e.getMessage()); return; 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 d6f40269..d58f7a46 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 @@ -47,7 +47,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 = server.config.authHandler[0].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 1f97c38d..793db407 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 @@ -13,7 +13,7 @@ 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); + UUID uuid = server.config.authHandler[0].usernameToUUID(username); if (uuid == null) { output.writeBoolean(false); return;