From ac1279ff5c6e5e9d725c814d79727bb3dfed7b8f Mon Sep 17 00:00:00 2001 From: Gravita Date: Tue, 9 Nov 2021 14:32:09 +0700 Subject: [PATCH] [FIX] HttpAuthCoreProvider --- .../auth/core/HttpAuthCoreProvider.java | 16 ++++++++++++---- props.gradle | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/HttpAuthCoreProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/HttpAuthCoreProvider.java index 08de95c8..0b0fd659 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/HttpAuthCoreProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/HttpAuthCoreProvider.java @@ -120,14 +120,22 @@ public AuthManager.AuthReport refreshAccessToken(String refreshToken, AuthRespon @Override public AuthManager.AuthReport authorize(String login, AuthResponse.AuthContext context, AuthRequest.AuthPasswordInterface password, boolean minecraftAccess) throws IOException { var result = requester.send(requester.post(authorizeUrl, new AuthorizeRequest(login, context, password, minecraftAccess), - bearerToken), AuthManager.AuthReport.class); + bearerToken), HttpAuthReport.class); if(!result.isSuccessful()) { var error = result.error().error; if(error != null) { throw new AuthException(error); } } - return result.getOrThrow(); + return result.getOrThrow().toAuthReport(); + } + + public record HttpAuthReport(String minecraftAccessToken, String oauthAccessToken, + String oauthRefreshToken, long oauthExpire, + HttpUserSession session) { + public AuthManager.AuthReport toAuthReport() { + return new AuthManager.AuthReport(minecraftAccessToken, oauthAccessToken, oauthRefreshToken, oauthExpire, session); + } } @Override @@ -303,13 +311,13 @@ public Texture getCloakTexture() { public static class HttpUserSession implements UserSession { private String id; - private User user; + private HttpUser user; private long expireIn; public HttpUserSession() { } - public HttpUserSession(String id, User user, long expireIn) { + public HttpUserSession(String id, HttpUser user, long expireIn) { this.id = id; this.user = user; this.expireIn = expireIn; diff --git a/props.gradle b/props.gradle index c85b8551..5a85c822 100644 --- a/props.gradle +++ b/props.gradle @@ -8,7 +8,7 @@ verJline = '3.20.0' verJwt = '0.11.2' verBcprov = '1.69' - verGson = '2.8.8' + verGson = '2.8.9' verBcpkix = '1.69' verSlf4j = '1.7.32' verLog4j = '2.14.1'