[FIX] Новый вид authType - API

This commit is contained in:
Gravit 2019-07-16 04:08:25 +07:00
parent 189f63efc3
commit 3c4b1a2543
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -50,7 +50,7 @@ public AuthResponse(String login, String password, String auth_id, OshiHWID hwid
public HWID hwid; public HWID hwid;
public enum ConnectTypes { public enum ConnectTypes {
SERVER, CLIENT, BOT SERVER, CLIENT, BOT, API
} }
@Override @Override
@ -128,7 +128,7 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
if (!clientData.permissions.canProxy) throw new AuthException("initProxy not allow"); if (!clientData.permissions.canProxy) throw new AuthException("initProxy not allow");
clientData.proxy = true; clientData.proxy = true;
} }
if (server.config.protectHandler.allowGetAccessToken(context)) { if (authType != ConnectTypes.API && server.config.protectHandler.allowGetAccessToken(context)) {
UUID uuid = pair.handler.auth(aresult); UUID uuid = pair.handler.auth(aresult);
result.playerProfile = ProfileByUUIDResponse.getProfile(uuid, aresult.username, client, clientData.auth.textureProvider); result.playerProfile = ProfileByUUIDResponse.getProfile(uuid, aresult.username, client, clientData.auth.textureProvider);
LogHelper.debug("Auth: %s accessToken %s uuid: %s", login, result.accessToken, uuid.toString()); LogHelper.debug("Auth: %s accessToken %s uuid: %s", login, result.accessToken, uuid.toString());
@ -140,10 +140,10 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
} }
public static class AuthContext { public static class AuthContext {
public AuthContext(long session, String login, int password_lenght, String customText, String client, String hwid, String ip, ConnectTypes authType) { public AuthContext(long session, String login, int password_length, String customText, String client, String hwid, String ip, ConnectTypes authType) {
this.session = session; this.session = session;
this.login = login; this.login = login;
this.password_lenght = password_lenght; this.password_length = password_length;
this.customText = customText; this.customText = customText;
this.client = client; this.client = client;
this.hwid = hwid; this.hwid = hwid;
@ -153,7 +153,7 @@ public AuthContext(long session, String login, int password_lenght, String custo
public long session; public long session;
public String login; public String login;
public int password_lenght; //Use AuthProvider for get password public int password_length; //Use AuthProvider for get password
public String client; public String client;
public String hwid; public String hwid;
public String customText; public String customText;