[FIX] HttpAuthCoreProvider

This commit is contained in:
Gravita 2021-11-09 14:32:09 +07:00
parent f8569f9165
commit ac1279ff5c
2 changed files with 13 additions and 5 deletions

View file

@ -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;

View file

@ -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'