[FIX] HttpAuthCoreProvider findmulti

This commit is contained in:
Gravita 2022-12-05 17:22:32 +07:00
parent 31b6ae35e7
commit a0722fb5f4
2 changed files with 9 additions and 2 deletions

View file

@ -59,6 +59,7 @@ public <T> HttpHelper.HttpOptional<T, SimpleError> send(HttpRequest request, Cla
return HttpHelper.send(httpClient, request, makeEH(clazz)); return HttpHelper.send(httpClient, request, makeEH(clazz));
} }
public static class SimpleErrorHandler<T> implements HttpHelper.HttpJsonErrorHandler<T, SimpleError> { public static class SimpleErrorHandler<T> implements HttpHelper.HttpJsonErrorHandler<T, SimpleError> {
private final Type type; private final Type type;

View file

@ -1,5 +1,6 @@
package pro.gravit.launchserver.auth.core; package pro.gravit.launchserver.auth.core;
import com.google.gson.reflect.TypeToken;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import pro.gravit.launcher.ClientPermissions; import pro.gravit.launcher.ClientPermissions;
@ -232,14 +233,15 @@ public void addPublicKeyToHardwareInfo(UserHardware hardware, byte[] publicKey)
} }
} }
@SuppressWarnings({"unchecked", "rawtypes"})
@Override @Override
public Iterable<User> getUsersByHardwareInfo(UserHardware hardware) { public Iterable<User> getUsersByHardwareInfo(UserHardware hardware) {
if (getUsersByHardwareInfoUrl == null) { if (getUsersByHardwareInfoUrl == null) {
return null; return null;
} }
try { try {
return requester.send(requester return (List<User>) (List) requester.send(requester
.post(getUsersByHardwareInfoUrl, new HardwareRequest((HttpUserHardware) hardware), bearerToken), List.class).getOrThrow(); .post(getUsersByHardwareInfoUrl, new HardwareRequest((HttpUserHardware) hardware), bearerToken), GetHardwareListResponse.class).getOrThrow().list;
} catch (IOException e) { } catch (IOException e) {
logger.error(e); logger.error(e);
return null; return null;
@ -354,6 +356,10 @@ public static class GetAuthDetailsResponse {
public List<GetAvailabilityAuthRequestEvent.AuthAvailabilityDetails> details; public List<GetAvailabilityAuthRequestEvent.AuthAvailabilityDetails> details;
} }
public static class GetHardwareListResponse {
public List<HttpUser> list;
}
public static class JoinServerRequest { public static class JoinServerRequest {
public String username; public String username;
public String accessToken; public String accessToken;