mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FEATURE][EXPERIMENTAL] Экспериментальная связка авторизации для прокси
This commit is contained in:
parent
f1cd39babd
commit
08f811add2
3 changed files with 13 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
|
||||
import ru.gravit.launcher.events.ExceptionEvent;
|
||||
import ru.gravit.launcher.events.RequestEvent;
|
||||
import ru.gravit.launcher.events.request.AuthRequestEvent;
|
||||
import ru.gravit.launcher.events.request.ErrorRequestEvent;
|
||||
import ru.gravit.launcher.hasher.HashedEntry;
|
||||
import ru.gravit.launcher.hasher.HashedEntryAdapter;
|
||||
|
@ -73,8 +74,17 @@ void process(ChannelHandlerContext ctx, TextWebSocketFrame frame, Client client)
|
|||
}
|
||||
LogHelper.debug("Proxy %s request", response.getType());
|
||||
ProxyRequest proxyRequest = new ProxyRequest(response, 0);
|
||||
proxyRequest.isCheckSign = client.checkSign;
|
||||
try {
|
||||
ResultInterface result = proxyRequest.request();
|
||||
if(result instanceof AuthRequestEvent)
|
||||
{
|
||||
LogHelper.debug("Client auth params get successful");
|
||||
AuthRequestEvent authRequestEvent = (AuthRequestEvent) result;
|
||||
client.isAuth = true;
|
||||
client.session = authRequestEvent.session;
|
||||
if(authRequestEvent.playerProfile != null) client.username = authRequestEvent.playerProfile.username;
|
||||
}
|
||||
sendObject(ctx, result);
|
||||
} catch (RequestException e)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
public class ProxyCommandResponse extends SimpleResponse {
|
||||
public JsonResponseInterface response;
|
||||
public long session;
|
||||
public boolean isCheckSign;
|
||||
@Override
|
||||
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||
if(!client.proxy) {
|
||||
|
@ -15,6 +16,7 @@ public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
|||
return;
|
||||
}
|
||||
Client real_client = server.sessionManager.getOrNewClient(session);
|
||||
real_client.checkSign = isCheckSign;
|
||||
response.execute(ctx, real_client);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
public class ProxyRequest extends Request<ResultInterface> implements RequestInterface {
|
||||
public RequestInterface response;
|
||||
public long session;
|
||||
public boolean isCheckSign;
|
||||
|
||||
public ProxyRequest(RequestInterface response, long session) {
|
||||
this.response = response;
|
||||
|
|
Loading…
Reference in a new issue