mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-01-09 00:59:44 +03:00
[FEATURE] Проверка на null для самых распространенных authHandler/authProvider
This commit is contained in:
parent
8d8eb2e9a3
commit
9ab1185cfb
3 changed files with 19 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue