mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FIX] HttpAuthCoreProvider
This commit is contained in:
parent
f8569f9165
commit
ac1279ff5c
2 changed files with 13 additions and 5 deletions
|
@ -120,14 +120,22 @@ public AuthManager.AuthReport refreshAccessToken(String refreshToken, AuthRespon
|
||||||
@Override
|
@Override
|
||||||
public AuthManager.AuthReport authorize(String login, AuthResponse.AuthContext context, AuthRequest.AuthPasswordInterface password, boolean minecraftAccess) throws IOException {
|
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),
|
var result = requester.send(requester.post(authorizeUrl, new AuthorizeRequest(login, context, password, minecraftAccess),
|
||||||
bearerToken), AuthManager.AuthReport.class);
|
bearerToken), HttpAuthReport.class);
|
||||||
if(!result.isSuccessful()) {
|
if(!result.isSuccessful()) {
|
||||||
var error = result.error().error;
|
var error = result.error().error;
|
||||||
if(error != null) {
|
if(error != null) {
|
||||||
throw new AuthException(error);
|
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
|
@Override
|
||||||
|
@ -303,13 +311,13 @@ public Texture getCloakTexture() {
|
||||||
|
|
||||||
public static class HttpUserSession implements UserSession {
|
public static class HttpUserSession implements UserSession {
|
||||||
private String id;
|
private String id;
|
||||||
private User user;
|
private HttpUser user;
|
||||||
private long expireIn;
|
private long expireIn;
|
||||||
|
|
||||||
public HttpUserSession() {
|
public HttpUserSession() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpUserSession(String id, User user, long expireIn) {
|
public HttpUserSession(String id, HttpUser user, long expireIn) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.expireIn = expireIn;
|
this.expireIn = expireIn;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
verJline = '3.20.0'
|
verJline = '3.20.0'
|
||||||
verJwt = '0.11.2'
|
verJwt = '0.11.2'
|
||||||
verBcprov = '1.69'
|
verBcprov = '1.69'
|
||||||
verGson = '2.8.8'
|
verGson = '2.8.9'
|
||||||
verBcpkix = '1.69'
|
verBcpkix = '1.69'
|
||||||
verSlf4j = '1.7.32'
|
verSlf4j = '1.7.32'
|
||||||
verLog4j = '2.14.1'
|
verLog4j = '2.14.1'
|
||||||
|
|
Loading…
Reference in a new issue