[FIX] Фикс неработоспособности Mojang авторизации (портирован)

This commit is contained in:
Gravit 2019-10-21 22:38:07 +07:00
parent a96365cf77
commit 1a3d231252
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
4 changed files with 5 additions and 5 deletions

View file

@ -24,7 +24,7 @@ public static final class Entry {
public Entry(UUID uuid, String username, String accessToken, String serverID) { public Entry(UUID uuid, String username, String accessToken, String serverID) {
this.uuid = Objects.requireNonNull(uuid, "uuid"); this.uuid = Objects.requireNonNull(uuid, "uuid");
this.username = Objects.requireNonNull(username, "username"); this.username = Objects.requireNonNull(username, "username");
this.accessToken = accessToken == null ? null : SecurityHelper.verifyToken(accessToken); this.accessToken = accessToken == null ? null : accessToken;
this.serverID = serverID == null ? null : VerifyHelper.verifyServerID(serverID); this.serverID = serverID == null ? null : VerifyHelper.verifyServerID(serverID);
} }
} }

View file

@ -22,7 +22,7 @@ public JoinServerResponse(LaunchServer server, long session, HInput input, HOutp
@Override @Override
public void reply() throws IOException { public void reply() throws IOException {
String username = VerifyHelper.verifyUsername(input.readString(SerializeLimits.MAX_LOGIN)); String username = VerifyHelper.verifyUsername(input.readString(SerializeLimits.MAX_LOGIN));
String accessToken = SecurityHelper.verifyToken(input.readASCII(-SecurityHelper.TOKEN_STRING_LENGTH)); String accessToken = input.readASCII(-SecurityHelper.TOKEN_STRING_LENGTH);
String serverID = VerifyHelper.verifyServerID(input.readASCII(SerializeLimits.MAX_SERVERID)); // With minus sign String serverID = VerifyHelper.verifyServerID(input.readASCII(SerializeLimits.MAX_SERVERID)); // With minus sign
if (!clientData.isAuth || clientData.type != Client.Type.USER) { if (!clientData.isAuth || clientData.type != Client.Type.USER) {
requestError("Access denied"); requestError("Access denied");

View file

@ -90,7 +90,7 @@ public Params(byte[] launcherDigest, Path assetDir, Path clientDir, PlayerProfil
this.clientDir = clientDir; this.clientDir = clientDir;
// Client params // Client params
this.pp = pp; this.pp = pp;
this.accessToken = SecurityHelper.verifyToken(accessToken); this.accessToken = accessToken;
this.autoEnter = autoEnter; this.autoEnter = autoEnter;
this.fullScreen = fullScreen; this.fullScreen = fullScreen;
this.ram = ram; this.ram = ram;
@ -110,7 +110,7 @@ public Params(HInput input) throws Exception {
pp = new PlayerProfile(input); pp = new PlayerProfile(input);
byte[] encryptedAccessToken = input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH); byte[] encryptedAccessToken = input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH);
String accessTokenD = new String(SecurityHelper.decrypt(Launcher.getConfig().secretKeyClient.getBytes(), encryptedAccessToken)); String accessTokenD = new String(SecurityHelper.decrypt(Launcher.getConfig().secretKeyClient.getBytes(), encryptedAccessToken));
accessToken = SecurityHelper.verifyToken(accessTokenD); accessToken = accessTokenD;
autoEnter = input.readBoolean(); autoEnter = input.readBoolean();
fullScreen = input.readBoolean(); fullScreen = input.readBoolean();
ram = input.readVarInt(); ram = input.readVarInt();

View file

@ -24,7 +24,7 @@ public final class JoinServerRequest extends Request<JoinServerRequestEvent> {
public JoinServerRequest(LauncherConfig config, String username, String accessToken, String serverID) { public JoinServerRequest(LauncherConfig config, String username, String accessToken, String serverID) {
super(config); super(config);
this.username = VerifyHelper.verifyUsername(username); this.username = VerifyHelper.verifyUsername(username);
this.accessToken = SecurityHelper.verifyToken(accessToken); this.accessToken = accessToken;
this.serverID = VerifyHelper.verifyServerID(serverID); this.serverID = VerifyHelper.verifyServerID(serverID);
} }