Launcher/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java

65 lines
1.8 KiB
Java
Raw Normal View History

package pro.gravit.launchserver.socket;
2018-09-17 10:07:32 +03:00
import pro.gravit.launcher.ClientPermissions;
import pro.gravit.launcher.profiles.ClientProfile;
2020-05-18 15:26:38 +03:00
import pro.gravit.launcher.request.secure.HardwareReportRequest;
import pro.gravit.launchserver.LaunchServer;
import pro.gravit.launchserver.auth.AuthProviderPair;
import pro.gravit.launchserver.dao.User;
import pro.gravit.launchserver.socket.response.auth.AuthResponse;
import pro.gravit.utils.helper.LogHelper;
2018-09-27 00:18:26 +03:00
import java.util.Map;
2018-09-17 10:07:32 +03:00
public class Client {
public long session;
public String auth_id;
2018-09-17 10:07:32 +03:00
public long timestamp;
public AuthResponse.ConnectTypes type;
2018-09-27 00:18:26 +03:00
public ClientProfile profile;
public boolean isAuth;
public boolean checkSign;
2018-10-01 13:08:16 +03:00
public ClientPermissions permissions;
public String username;
2020-03-20 04:44:24 +03:00
public TrustLevel trustLevel;
2018-09-22 17:33:00 +03:00
public transient AuthProviderPair auth;
public transient User daoObject;
public transient Map<String, Object> properties;
2018-09-17 10:07:32 +03:00
public Client(long session) {
this.session = session;
timestamp = System.currentTimeMillis();
type = null;
2018-09-27 00:18:26 +03:00
isAuth = false;
2018-10-01 13:08:16 +03:00
permissions = ClientPermissions.DEFAULT;
username = "";
checkSign = false;
2018-09-17 10:07:32 +03:00
}
2018-11-08 15:30:16 +03:00
//Данные авторизации
2018-09-17 10:07:32 +03:00
public void up() {
timestamp = System.currentTimeMillis();
}
2019-04-03 16:27:40 +03:00
public void updateAuth(LaunchServer server) {
2019-04-03 16:27:40 +03:00
if (!isAuth) return;
if (auth_id.isEmpty()) auth = server.config.getAuthProviderPair();
else auth = server.config.getAuthProviderPair(auth_id);
}
2018-11-08 15:30:16 +03:00
public enum Type {
2018-09-27 00:18:26 +03:00
SERVER,
USER
}
2020-04-05 10:27:04 +03:00
public static class TrustLevel {
2020-03-20 04:44:24 +03:00
public byte[] verifySecureKey;
2020-03-21 23:36:52 +03:00
public boolean keyChecked;
public byte[] publicKey;
2020-05-18 15:26:38 +03:00
public HardwareReportRequest.HardwareInfo hardwareInfo;
2020-03-20 04:44:24 +03:00
}
2018-09-17 10:07:32 +03:00
}