mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
AuthResponse fix
This commit is contained in:
parent
a32402f1a6
commit
6f16819cad
1 changed files with 6 additions and 7 deletions
|
@ -19,7 +19,6 @@
|
|||
public class AuthResponse implements JsonResponseInterface {
|
||||
public String login;
|
||||
public String client;
|
||||
private LaunchServer server = LaunchServer.server;
|
||||
|
||||
public String password;
|
||||
|
||||
|
@ -41,21 +40,21 @@ public String getType() {
|
|||
public void execute(WebSocketService service, ChannelHandlerContext ctx) throws Exception {
|
||||
try {
|
||||
String ip = IOHelper.getIP(ctx.channel().remoteAddress());
|
||||
if (server.limiter.isLimit(ip)) {
|
||||
AuthProvider.authError(server.config.authRejectString);
|
||||
if (LaunchServer.server.limiter.isLimit(ip)) {
|
||||
AuthProvider.authError(LaunchServer.server.config.authRejectString);
|
||||
return;
|
||||
}
|
||||
AuthProvider provider = server.config.authProvider[authid];
|
||||
AuthProvider provider = LaunchServer.server.config.authProvider[authid];
|
||||
AuthProviderResult result = provider.auth(login, password, ip);
|
||||
if (!VerifyHelper.isValidUsername(result.username)) {
|
||||
AuthProvider.authError(String.format("Illegal result: '%s'", result.username));
|
||||
return;
|
||||
}
|
||||
Collection<SignedObjectHolder<ClientProfile>> profiles = server.getProfiles();
|
||||
Collection<SignedObjectHolder<ClientProfile>> profiles = LaunchServer.server.getProfiles();
|
||||
for (SignedObjectHolder<ClientProfile> p : profiles) {
|
||||
if (p.object.getTitle().equals(client)) {
|
||||
if (!p.object.isWhitelistContains(login)) {
|
||||
throw new AuthException(server.config.whitelistRejectString);
|
||||
throw new AuthException(LaunchServer.server.config.whitelistRejectString);
|
||||
}
|
||||
//clientData.profile = p.object;
|
||||
}
|
||||
|
@ -63,7 +62,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx) throws
|
|||
//if(clientData.profile == null) {
|
||||
// throw new AuthException("You profile not found");
|
||||
//}
|
||||
server.config.hwidHandler.check(hwid, result.username);
|
||||
LaunchServer.server.config.hwidHandler.check(hwid, result.username);
|
||||
service.sendObject(ctx,new WebSocketService.SuccessResult("auth"));
|
||||
} catch (AuthException | HWIDException e)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue