[FIX] Delete deprecated Client params

This commit is contained in:
Gravit 2020-03-22 03:24:18 +07:00
parent c57cb90700
commit 7527251841
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
6 changed files with 6 additions and 13 deletions

View file

@ -10,7 +10,7 @@ public class AdvancedProtectHandler extends ProtectHandler implements SecureProt
@Override @Override
public boolean allowGetAccessToken(AuthResponse.AuthContext context) { public boolean allowGetAccessToken(AuthResponse.AuthContext context) {
return (context.authType == AuthResponse.ConnectTypes.CLIENT) && context.client.isSecure; return (context.authType == AuthResponse.ConnectTypes.CLIENT) && context.client.checkSign;
} }
@Override @Override
@ -25,6 +25,6 @@ public GetSecureLevelInfoRequestEvent onGetSecureLevelInfo(GetSecureLevelInfoReq
@Override @Override
public boolean allowGetSecureLevelInfo(Client client) { public boolean allowGetSecureLevelInfo(Client client) {
return client.isSecure; return client.checkSign;
} }
} }

View file

@ -8,7 +8,7 @@ public class StdProtectHandler extends ProtectHandler {
@Override @Override
public boolean allowGetAccessToken(AuthResponse.AuthContext context) { public boolean allowGetAccessToken(AuthResponse.AuthContext context) {
return (context.authType == AuthResponse.ConnectTypes.CLIENT) && (!checkSecure || context.client.isSecure); return (context.authType == AuthResponse.ConnectTypes.CLIENT) && (!checkSecure || context.client.checkSign);
} }
@Override @Override

View file

@ -34,7 +34,7 @@ public void invoke(String... args) {
LogHelper.info("Channel %s | connectUUID %s | checkSign %s", ip, frameHandler.getConnectUUID(), client.checkSign ? "true" : "false"); LogHelper.info("Channel %s | connectUUID %s | checkSign %s", ip, frameHandler.getConnectUUID(), client.checkSign ? "true" : "false");
else { else {
LogHelper.info("Client name %s | ip %s | connectUUID %s", client.username == null ? "null" : client.username, ip, frameHandler.getConnectUUID()); LogHelper.info("Client name %s | ip %s | connectUUID %s", client.username == null ? "null" : client.username, ip, frameHandler.getConnectUUID());
LogHelper.subInfo("Data: checkSign %s | isSecure %s | auth_id %s", client.checkSign ? "true" : "false", client.isSecure ? "true" : "false", LogHelper.subInfo("Data: checkSign %s | auth_id %s", client.checkSign ? "true" : "false",
client.auth_id); client.auth_id);
LogHelper.subInfo("Permissions: %s (long %d)", client.permissions == null ? "null" : client.permissions.toString(), client.permissions == null ? 0 : client.permissions.toLong()); LogHelper.subInfo("Permissions: %s (long %d)", client.permissions == null ? "null" : client.permissions.toString(), client.permissions == null ? 0 : client.permissions.toLong());
} }

View file

@ -15,10 +15,8 @@ public class Client {
public ClientProfile profile; public ClientProfile profile;
public boolean isAuth; public boolean isAuth;
public boolean checkSign; public boolean checkSign;
public boolean isSecure;
public ClientPermissions permissions; public ClientPermissions permissions;
public String username; public String username;
public String verifyToken;
public TrustLevel trustLevel; public TrustLevel trustLevel;
public transient LogHelper.OutputEnity logOutput; public transient LogHelper.OutputEnity logOutput;

View file

@ -36,7 +36,6 @@ public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
return; return;
} }
Client newClient = new Client(0); Client newClient = new Client(0);
newClient.isSecure = client.isSecure;
newClient.checkSign = client.checkSign; newClient.checkSign = client.checkSign;
handler.setClient(newClient); handler.setClient(newClient);
if(client.session != 0) server.sessionManager.removeClient(client.session); if(client.session != 0) server.sessionManager.removeClient(client.session);
@ -56,7 +55,6 @@ public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
if(chClient.session != client.session) return; if(chClient.session != client.session) return;
} }
Client newCusClient = new Client(0); Client newCusClient = new Client(0);
newCusClient.isSecure = chClient.isSecure;
newCusClient.checkSign = chClient.checkSign; newCusClient.checkSign = chClient.checkSign;
wsHandler.setClient(newCusClient); wsHandler.setClient(newCusClient);
if(chClient.session != 0) server.sessionManager.removeClient(chClient.session); if(chClient.session != 0) server.sessionManager.removeClient(chClient.session);
@ -76,7 +74,6 @@ public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
Client chClient = wsHandler.getClient(); Client chClient = wsHandler.getClient();
if(!chClient.isAuth || !username.equals(chClient.username)) return; if(!chClient.isAuth || !username.equals(chClient.username)) return;
Client newCusClient = new Client(0); Client newCusClient = new Client(0);
newCusClient.isSecure = chClient.isSecure;
newCusClient.checkSign = chClient.checkSign; newCusClient.checkSign = chClient.checkSign;
wsHandler.setClient(newCusClient); wsHandler.setClient(newCusClient);
if(chClient.session != 0) server.sessionManager.removeClient(chClient.session); if(chClient.session != 0) server.sessionManager.removeClient(chClient.session);

View file

@ -36,9 +36,8 @@ public void execute(ChannelHandlerContext ctx, Client client) {
byte[] hash = server.launcherBinary.getDigest(); byte[] hash = server.launcherBinary.getDigest();
if (hash == null) if (hash == null)
service.sendObjectAndClose(ctx, new LauncherRequestEvent(true, server.config.netty.launcherURL)); service.sendObjectAndClose(ctx, new LauncherRequestEvent(true, server.config.netty.launcherURL));
if (Arrays.equals(bytes, hash)) { if (Arrays.equals(bytes, hash) && checkSecure(secureHash, secureSalt)) {
client.checkSign = true; client.checkSign = true;
client.isSecure = checkSecure(secureHash, secureSalt);
sendResult(new LauncherRequestEvent(false, server.config.netty.launcherURL)); sendResult(new LauncherRequestEvent(false, server.config.netty.launcherURL));
} else { } else {
sendResultAndClose(new LauncherRequestEvent(true, server.config.netty.launcherURL)); sendResultAndClose(new LauncherRequestEvent(true, server.config.netty.launcherURL));
@ -47,9 +46,8 @@ public void execute(ChannelHandlerContext ctx, Client client) {
{ {
byte[] hash = server.launcherEXEBinary.getDigest(); byte[] hash = server.launcherEXEBinary.getDigest();
if (hash == null) sendResultAndClose(new LauncherRequestEvent(true, server.config.netty.launcherEXEURL)); if (hash == null) sendResultAndClose(new LauncherRequestEvent(true, server.config.netty.launcherEXEURL));
if (Arrays.equals(bytes, hash)) { if (Arrays.equals(bytes, hash) && checkSecure(secureHash, secureSalt)) {
client.checkSign = true; client.checkSign = true;
client.isSecure = checkSecure(secureHash, secureSalt);
sendResult(new LauncherRequestEvent(false, server.config.netty.launcherEXEURL)); sendResult(new LauncherRequestEvent(false, server.config.netty.launcherEXEURL));
} else { } else {
sendResultAndClose(new LauncherRequestEvent(true, server.config.netty.launcherEXEURL)); sendResultAndClose(new LauncherRequestEvent(true, server.config.netty.launcherEXEURL));