mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
Привилегии
This commit is contained in:
parent
b60bdb72fa
commit
79acc5b503
5 changed files with 27 additions and 0 deletions
|
@ -0,0 +1,12 @@
|
|||
package ru.gravit.launchserver.auth;
|
||||
|
||||
public class ClientPermissions {
|
||||
public static final ClientPermissions DEFAULT = new ClientPermissions();
|
||||
public boolean canAdmin;
|
||||
public boolean canServer;
|
||||
|
||||
public ClientPermissions() {
|
||||
canAdmin = false;
|
||||
canServer = false;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,21 @@
|
|||
package ru.gravit.launchserver.auth.provider;
|
||||
|
||||
import ru.gravit.launchserver.auth.ClientPermissions;
|
||||
|
||||
|
||||
public class AuthProviderResult {
|
||||
public final String username;
|
||||
public final String accessToken;
|
||||
public final ClientPermissions permissions;
|
||||
|
||||
public AuthProviderResult(String username, String accessToken) {
|
||||
this.username = username;
|
||||
this.accessToken = accessToken;
|
||||
permissions = ClientPermissions.DEFAULT;
|
||||
}
|
||||
public AuthProviderResult(String username, String accessToken,ClientPermissions permissions) {
|
||||
this.username = username;
|
||||
this.accessToken = accessToken;
|
||||
this.permissions = permissions;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ public void reply() throws Exception {
|
|||
}
|
||||
debug("Auth: '%s' -> '%s', '%s'", login, result.username, result.accessToken);
|
||||
clientData.isAuth = true;
|
||||
clientData.permissions = result.permissions;
|
||||
// Authenticate on server (and get UUID)
|
||||
UUID uuid;
|
||||
try {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ru.gravit.launchserver.socket;
|
||||
|
||||
import ru.gravit.launcher.profiles.ClientProfile;
|
||||
import ru.gravit.launchserver.auth.ClientPermissions;
|
||||
|
||||
public class Client {
|
||||
public long session;
|
||||
|
@ -9,12 +10,14 @@ public class Client {
|
|||
public Type type;
|
||||
public ClientProfile profile;
|
||||
public boolean isAuth;
|
||||
public ClientPermissions permissions;
|
||||
|
||||
public Client(long session) {
|
||||
this.session = session;
|
||||
timestamp = System.currentTimeMillis();
|
||||
type = Type.USER;
|
||||
isAuth = false;
|
||||
permissions = ClientPermissions.DEFAULT;
|
||||
}
|
||||
//Данные ваторизации
|
||||
public void up() {
|
||||
|
|
|
@ -65,6 +65,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
|||
}
|
||||
LaunchServer.server.config.hwidHandler.check(hwid, result.username);
|
||||
clientData.isAuth = true;
|
||||
clientData.permissions = result.permissions;
|
||||
service.sendObject(ctx,new WebSocketService.SuccessResult("auth"));
|
||||
} catch (AuthException | HWIDException e)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue