diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/HibernateAuthHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/HibernateAuthHandler.java index c7a3a3fa..74f31969 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/HibernateAuthHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/HibernateAuthHandler.java @@ -23,7 +23,6 @@ protected Entry fetchEntry(UUID uuid) { @Override protected boolean updateAuth(UUID uuid, String username, String accessToken) { User user = srv.config.dao.userDAO.findByUUID(uuid); - LogHelper.debug("UpdateAuth: %s: %s", uuid == null ? "null" : uuid.toString(), user == null ? "null" : user.getUsername()); user.setAccessToken(accessToken); srv.config.dao.userDAO.update(user); return true; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java index e23d4f48..9dfe51be 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java @@ -3,6 +3,7 @@ import pro.gravit.launcher.events.request.GetSecureLevelInfoRequestEvent; import pro.gravit.launcher.events.request.HardwareReportRequestEvent; import pro.gravit.launcher.events.request.VerifySecureLevelKeyRequestEvent; +import pro.gravit.launchserver.LaunchServer; import pro.gravit.launchserver.Reconfigurable; import pro.gravit.launchserver.auth.protect.hwid.HWIDException; import pro.gravit.launchserver.auth.protect.hwid.HWIDProvider; @@ -21,6 +22,7 @@ public class AdvancedProtectHandler extends StdProtectHandler implements SecureProtectHandler, HardwareProtectHandler, JoinServerProtectHandler, Reconfigurable { public boolean enableHardwareFeature; public HWIDProvider provider; + private LaunchServer server; @Override public boolean allowGetAccessToken(AuthResponse.AuthContext context) { @@ -107,9 +109,9 @@ public boolean onJoinServer(String serverID, String username, Client client) { } @Override - public void init() { + public void init(LaunchServer server) { if(provider != null) - provider.init(); + provider.init(server); } @Override diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/ProtectHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/ProtectHandler.java index ce19e627..98e4ffe1 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/ProtectHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/ProtectHandler.java @@ -1,5 +1,6 @@ package pro.gravit.launchserver.auth.protect; +import pro.gravit.launchserver.LaunchServer; import pro.gravit.launchserver.socket.response.auth.AuthResponse; import pro.gravit.utils.ProviderMap; @@ -21,7 +22,7 @@ public static void registerHandlers() { public abstract void checkLaunchServerLicense(); //Выдает SecurityException при ошибке проверки лицензии - public void init() + public void init(LaunchServer server) { } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/HWIDProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/HWIDProvider.java index 3801422a..138b1546 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/HWIDProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/HWIDProvider.java @@ -1,6 +1,7 @@ package pro.gravit.launchserver.auth.protect.hwid; import pro.gravit.launcher.request.secure.HardwareReportRequest; +import pro.gravit.launchserver.LaunchServer; import pro.gravit.launchserver.helper.DamerauHelper; import pro.gravit.launchserver.socket.Client; import pro.gravit.utils.ProviderMap; @@ -107,7 +108,7 @@ protected void printHardwareInfo(LogHelper.Level logLevel, HardwareReportRequest LogHelper.log(logLevel, String.format("[HardwareInfo] HWDiskID %s | baseboardSerialNumber %s | displayId hash: %s", info.hwDiskId, info.baseboardSerialNumber, SecurityHelper.toHex(SecurityHelper.digest(SecurityHelper.DigestAlgorithm.MD5, info.displayId))) , false); } - public void init() + public void init(LaunchServer server) { } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java index 7e69fa59..00dfa188 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java @@ -1,6 +1,7 @@ package pro.gravit.launchserver.auth.protect.hwid; import pro.gravit.launcher.request.secure.HardwareReportRequest; +import pro.gravit.launchserver.LaunchServer; import pro.gravit.launchserver.auth.MySQLSourceConfig; import pro.gravit.launchserver.socket.Client; import pro.gravit.utils.helper.IOHelper; @@ -29,7 +30,7 @@ public class MysqlHWIDProvider extends HWIDProvider { private String sqlUpdateUsers; @Override - public void init() { + public void init(LaunchServer server) { sqlFindByPublicKey = String.format("SELECT hwDiskId, baseboardSerialNumber, displayId, bitness, totalMemory, logicalProcessors, physicalProcessors, processorMaxFreq, battery, id, banned FROM %s WHERE `publicKey` = ?", tableHWID); sqlFindByHardware = String.format("SELECT hwDiskId, baseboardSerialNumber, displayId, bitness, totalMemory, logicalProcessors, physicalProcessors, processorMaxFreq, battery, id, banned FROM %s", tableHWID); sqlCreateHardware = String.format("INSERT INTO `%s` (`publickey`, `hwDiskId`, `baseboardSerialNumber`, `displayId`, `bitness`, `totalMemory`, `logicalProcessors`, `physicalProcessors`, `processorMaxFreq`, `battery`, `banned`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '0')", tableHWID); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index c3d29578..cd5d3072 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -184,7 +184,7 @@ public void init(LaunchServer.ReloadType type) { } if (protectHandler != null) { server.registerObject("protectHandler", protectHandler); - protectHandler.init(); + protectHandler.init(server); protectHandler.checkLaunchServerLicense(); } if (components != null) {