From 9ab1185cfbaff1a24b026db08a112f3864a9465e Mon Sep 17 00:00:00 2001 From: Gravit Date: Sat, 12 Jan 2019 01:16:06 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=9F=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=BA=D0=B0=20=D0=BD=D0=B0=20null=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=81=D0=B0=D0=BC=D1=8B=D1=85=20=D1=80=D0=B0=D1=81=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20authHandler/authProvider?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../launchserver/auth/handler/MySQLAuthHandler.java | 8 ++++++++ .../launchserver/auth/provider/MySQLAuthProvider.java | 8 ++++++++ .../launchserver/auth/provider/RequestAuthProvider.java | 3 +++ 3 files changed, 19 insertions(+) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/MySQLAuthHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/MySQLAuthHandler.java index 0cdde91d..41d65110 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/MySQLAuthHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/MySQLAuthHandler.java @@ -8,6 +8,7 @@ import java.util.UUID; import ru.gravit.launchserver.auth.MySQLSourceConfig; +import ru.gravit.utils.helper.LogHelper; public final class MySQLAuthHandler extends CachedAuthHandler { private MySQLSourceConfig mySQLHolder; @@ -25,6 +26,13 @@ public final class MySQLAuthHandler extends CachedAuthHandler { @Override public void init() { + //Verify + if(mySQLHolder == null) LogHelper.error("[Verify][AuthHandler] mySQLHolder cannot be null"); + if(uuidColumn == null) LogHelper.error("[Verify][AuthHandler] uuidColumn cannot be null"); + if(usernameColumn == null) LogHelper.error("[Verify][AuthHandler] usernameColumn cannot be null"); + if(accessTokenColumn == null) LogHelper.error("[Verify][AuthHandler] accessTokenColumn cannot be null"); + if(serverIDColumn == null) LogHelper.error("[Verify][AuthHandler] serverIDColumn cannot be null"); + if(table == null) LogHelper.error("[Verify][AuthHandler] table cannot be null"); // Prepare SQL queries queryByUUIDSQL = String.format("SELECT %s, %s, %s, %s FROM %s WHERE %s=? LIMIT 1", uuidColumn, usernameColumn, accessTokenColumn, serverIDColumn, table, uuidColumn); 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 b3554bd5..9f2dcdb0 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 @@ -9,6 +9,7 @@ import ru.gravit.launchserver.auth.AuthException; import ru.gravit.launchserver.auth.MySQLSourceConfig; import ru.gravit.utils.helper.CommonHelper; +import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.SecurityHelper; public final class MySQLAuthProvider extends AuthProvider { @@ -18,6 +19,13 @@ public final class MySQLAuthProvider extends AuthProvider { private String[] queryParams; private boolean usePermission; + @Override + public void init() { + if(query == null) LogHelper.error("[Verify][AuthProvider] query cannot be null"); + if(message == null) LogHelper.error("[Verify][AuthProvider] message cannot be null"); + if(mySQLHolder == null) LogHelper.error("[Verify][AuthProvider] mySQLHolder cannot be null"); + } + @Override public AuthProviderResult auth(String login, String password, String ip) throws SQLException, AuthException { Connection c = mySQLHolder.getConnection(); 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 0d5a10c2..917ca21e 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 @@ -8,6 +8,7 @@ import ru.gravit.launcher.ClientPermissions; import ru.gravit.utils.helper.CommonHelper; import ru.gravit.utils.helper.IOHelper; +import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.SecurityHelper; public final class RequestAuthProvider extends AuthProvider { @@ -19,6 +20,8 @@ public final class RequestAuthProvider extends AuthProvider { @Override public void init() { + if(url == null) LogHelper.error("[Verify][AuthProvider] url cannot be null"); + if(response == null) LogHelper.error("[Verify][AuthProvider] response cannot be null"); pattern = Pattern.compile(response); }