[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));
}
public static class SimpleErrorHandler<T> implements HttpHelper.HttpJsonErrorHandler<T, SimpleError> {
private final Type type;

View file

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