2019-06-02 05:03:08 +03:00
|
|
|
package pro.gravit.launchserver.socket;
|
2018-09-17 10:07:32 +03:00
|
|
|
|
2019-06-02 05:03:08 +03:00
|
|
|
import pro.gravit.launcher.ClientPermissions;
|
|
|
|
import pro.gravit.launcher.profiles.ClientProfile;
|
|
|
|
import pro.gravit.launchserver.LaunchServer;
|
|
|
|
import pro.gravit.launchserver.auth.AuthProviderPair;
|
|
|
|
import pro.gravit.utils.helper.LogHelper;
|
2018-09-27 00:18:26 +03:00
|
|
|
|
2018-09-17 10:07:32 +03:00
|
|
|
public class Client {
|
|
|
|
public long session;
|
2019-05-03 19:07:37 +03:00
|
|
|
public boolean proxy;
|
2019-03-22 09:14:29 +03:00
|
|
|
public String auth_id;
|
2018-09-17 10:07:32 +03:00
|
|
|
public long timestamp;
|
2018-09-27 00:18:26 +03:00
|
|
|
public Type type;
|
|
|
|
public ClientProfile profile;
|
|
|
|
public boolean isAuth;
|
2018-10-25 15:36:57 +03:00
|
|
|
public boolean checkSign;
|
2019-04-12 00:58:45 +03:00
|
|
|
public boolean isSecure;
|
2018-10-01 13:08:16 +03:00
|
|
|
public ClientPermissions permissions;
|
2018-10-07 10:17:37 +03:00
|
|
|
public String username;
|
2019-04-13 17:29:12 +03:00
|
|
|
public String verifyToken;
|
2019-05-04 12:13:10 +03:00
|
|
|
public transient LogHelper.OutputEnity logOutput;
|
2018-09-22 17:33:00 +03:00
|
|
|
|
2019-03-22 09:14:29 +03:00
|
|
|
public transient AuthProviderPair auth;
|
|
|
|
|
2018-09-17 10:07:32 +03:00
|
|
|
public Client(long session) {
|
|
|
|
this.session = session;
|
|
|
|
timestamp = System.currentTimeMillis();
|
2018-09-27 00:18:26 +03:00
|
|
|
type = Type.USER;
|
|
|
|
isAuth = false;
|
2018-10-01 13:08:16 +03:00
|
|
|
permissions = ClientPermissions.DEFAULT;
|
2018-10-07 10:17:37 +03:00
|
|
|
username = "";
|
2018-10-25 15:36:57 +03:00
|
|
|
checkSign = false;
|
2018-09-17 10:07:32 +03:00
|
|
|
}
|
2018-11-08 15:30:16 +03:00
|
|
|
|
2019-03-22 09:14:29 +03:00
|
|
|
//Данные авторизации
|
2018-09-17 10:07:32 +03:00
|
|
|
public void up() {
|
|
|
|
timestamp = System.currentTimeMillis();
|
|
|
|
}
|
2019-04-03 16:27:40 +03:00
|
|
|
|
2019-06-03 11:50:28 +03:00
|
|
|
public void updateAuth(LaunchServer server) {
|
2019-04-03 16:27:40 +03:00
|
|
|
if (!isAuth) return;
|
2019-06-03 11:50:28 +03:00
|
|
|
if (auth_id.isEmpty()) auth = server.config.getAuthProviderPair();
|
|
|
|
else auth = server.config.getAuthProviderPair(auth_id);
|
2019-03-22 09:14:29 +03:00
|
|
|
}
|
2018-11-08 15:30:16 +03:00
|
|
|
|
|
|
|
public enum Type {
|
2018-09-27 00:18:26 +03:00
|
|
|
SERVER,
|
|
|
|
USER
|
|
|
|
}
|
2018-09-17 10:07:32 +03:00
|
|
|
}
|