[FIX] verifyToken

This commit is contained in:
Gravit 2019-04-13 21:29:12 +07:00
parent 5e7230de21
commit 0283110a92
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
5 changed files with 5 additions and 3 deletions

View file

@ -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;
} }

View file

@ -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 при ошибке проверки лицензии

View file

@ -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;

View file

@ -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));
} }
} }

View file

@ -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));
} }