diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/JsonCoreProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/JsonCoreProvider.java index 234df17d..a8960449 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/JsonCoreProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/JsonCoreProvider.java @@ -2,12 +2,14 @@ import pro.gravit.launcher.ClientPermissions; import pro.gravit.launcher.Launcher; +import pro.gravit.launcher.events.request.GetAvailabilityAuthRequestEvent; import pro.gravit.launcher.request.auth.AuthRequest; import pro.gravit.launcher.request.auth.password.AuthPlainPassword; import pro.gravit.launchserver.LaunchServer; import pro.gravit.launchserver.auth.AuthException; import pro.gravit.launchserver.auth.password.PasswordVerifier; import pro.gravit.launchserver.manangers.AuthManager; +import pro.gravit.launchserver.socket.Client; import pro.gravit.launchserver.socket.response.auth.AuthResponse; import java.io.IOException; @@ -19,12 +21,14 @@ import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; +import java.util.List; import java.util.UUID; public class JsonCoreProvider extends AuthCoreProvider { public String getUserByUsernameUrl; public String getUserByUUIDUrl; public String getUserSessionByOAuthAccessTokenUrl; + public String getAuthDetailsUrl; public String refreshAccessTokenUrl; public String verifyPasswordUrl; public String createOAuthSessionUrl; @@ -125,6 +129,14 @@ public JsonGetUserSessionByOAuthTokenResponse() { } } + public static class JsonGetDetails { + + } + + public static class JsonGetDetailsResponse { + public List details; + } + @Override public User getUserByUsername(String username) { return jsonRequest(new JsonGetUserByUsername(username), getUserByUsernameUrl, JsonUser.class); @@ -143,6 +155,16 @@ public UserSession getUserSessionByOAuthAccessToken(String accessToken) throws O return response.session; } + @Override + public List getDetails(Client client) { + if (getAuthDetailsUrl != null) { + JsonGetDetailsResponse response = jsonRequest(new JsonGetDetails(), getAuthDetailsUrl, JsonGetDetailsResponse.class); + if (response == null) return super.getDetails(client); + return response.details; + } + return super.getDetails(client); + } + @Override public AuthManager.AuthReport refreshAccessToken(String refreshToken, AuthResponse.AuthContext context) { JsonAuthReportResponse response = jsonRequest(new JsonRefreshToken(refreshToken, context.ip), this.refreshAccessTokenUrl, JsonAuthReportResponse.class);