From abe904d73c6eb8dc740f1f115f2828cb8b0ce3c6 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Wed, 2 Oct 2024 20:50:36 +0700 Subject: [PATCH] [FEATURE] ExtendedCheckServer support in SQLAuthCoreProvider --- .../launchserver/auth/core/SQLCoreProvider.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/SQLCoreProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/SQLCoreProvider.java index 34d131e3..990840a0 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/SQLCoreProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/SQLCoreProvider.java @@ -7,8 +7,10 @@ import pro.gravit.launchserver.auth.MySQLSourceConfig; import pro.gravit.launchserver.auth.SQLSourceConfig; import pro.gravit.launchserver.auth.core.interfaces.UserHardware; +import pro.gravit.launchserver.auth.core.interfaces.provider.AuthSupportExtendedCheckServer; import pro.gravit.launchserver.auth.core.interfaces.provider.AuthSupportHardware; import pro.gravit.launchserver.auth.core.interfaces.session.UserSessionSupportHardware; +import pro.gravit.launchserver.socket.Client; import pro.gravit.utils.helper.IOHelper; import java.io.ByteArrayInputStream; @@ -19,7 +21,7 @@ import java.util.List; import java.util.UUID; -public class SQLCoreProvider extends AbstractSQLCoreProvider implements AuthSupportHardware { +public class SQLCoreProvider extends AbstractSQLCoreProvider implements AuthSupportHardware, AuthSupportExtendedCheckServer { public HikariSQLSourceConfig holder; @Override @@ -291,6 +293,18 @@ protected AbstractSQLCoreProvider.SQLUserSession createSession(AbstractSQLCorePr return new SQLUserSession(user); } + @Override + public UserSession extendedCheckServer(Client client, String username, String serverID) throws IOException { + AbstractSQLCoreProvider.SQLUser user = (AbstractSQLCoreProvider.SQLUser) getUserByUsername(username); + if (user == null) { + return null; + } + if (user.getUsername().equals(username) && user.getServerId().equals(serverID)) { + return createSession(user); + } + return null; + } + public class SQLUserSession extends AbstractSQLCoreProvider.SQLUserSession implements UserSessionSupportHardware { private transient SQLUser SQLUser; protected transient SQLUserHardware hardware;