mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] verifyToken
This commit is contained in:
parent
5e7230de21
commit
0283110a92
5 changed files with 5 additions and 3 deletions
|
@ -15,7 +15,7 @@ public String generateClientSecureToken() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean verifyClientSecureToken(String token) {
|
public boolean verifyClientSecureToken(String token, String secureKey) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public static void registerHandlers() {
|
||||||
public abstract String generateSecureToken(AuthResponse.AuthContext context); //Генерация токена для передачи его в LauncherGuardInterface
|
public abstract String generateSecureToken(AuthResponse.AuthContext context); //Генерация токена для передачи его в LauncherGuardInterface
|
||||||
|
|
||||||
public abstract String generateClientSecureToken();
|
public abstract String generateClientSecureToken();
|
||||||
public abstract boolean verifyClientSecureToken(String token);
|
public abstract boolean verifyClientSecureToken(String token, String secureKey);
|
||||||
public abstract boolean allowGetAccessToken(AuthResponse.AuthContext context);
|
public abstract boolean allowGetAccessToken(AuthResponse.AuthContext context);
|
||||||
|
|
||||||
public abstract void checkLaunchServerLicense(); //Выдает SecurityException при ошибке проверки лицензии
|
public abstract void checkLaunchServerLicense(); //Выдает SecurityException при ошибке проверки лицензии
|
||||||
|
|
|
@ -17,6 +17,7 @@ public class Client {
|
||||||
public boolean isSecure;
|
public boolean isSecure;
|
||||||
public ClientPermissions permissions;
|
public ClientPermissions permissions;
|
||||||
public String username;
|
public String username;
|
||||||
|
public String verifyToken;
|
||||||
public LogHelper.OutputEnity logOutput;
|
public LogHelper.OutputEnity logOutput;
|
||||||
|
|
||||||
public transient AuthProviderPair auth;
|
public transient AuthProviderPair auth;
|
||||||
|
|
|
@ -16,6 +16,7 @@ public String getType() {
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
String secureToken = LaunchServer.server.config.protectHandler.generateClientSecureToken();
|
String secureToken = LaunchServer.server.config.protectHandler.generateClientSecureToken();
|
||||||
|
client.verifyToken = secureToken;
|
||||||
service.sendObject(ctx, new GetSecureTokenRequestEvent(secureToken));
|
service.sendObject(ctx, new GetSecureTokenRequestEvent(secureToken));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public String getType() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
boolean success = LaunchServer.server.config.protectHandler.verifyClientSecureToken(secureToken);
|
boolean success = LaunchServer.server.config.protectHandler.verifyClientSecureToken(secureToken, client.verifyToken);
|
||||||
if(success) client.isSecure = true;
|
if(success) client.isSecure = true;
|
||||||
service.sendObject(ctx, new VerifySecureTokenRequestEvent(success));
|
service.sendObject(ctx, new VerifySecureTokenRequestEvent(success));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue