diff --git a/.idea/misc.xml b/.idea/misc.xml
index aa4b726..1007652 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/LaunchServer/LaunchServer.iml b/LaunchServer/LaunchServer.iml
index a862a9c..ea3e4b4 100644
--- a/LaunchServer/LaunchServer.iml
+++ b/LaunchServer/LaunchServer.iml
@@ -1,15 +1,5 @@
-
-
-
-
- SPIGOT
- BUNGEECORD
-
-
-
-
diff --git a/LaunchServer/resources/launchserver/defaults/profile1.12.1.cfg b/LaunchServer/resources/launchserver/defaults/profile1.12.1.cfg
deleted file mode 100644
index af7aa50..0000000
--- a/LaunchServer/resources/launchserver/defaults/profile1.12.1.cfg
+++ /dev/null
@@ -1,44 +0,0 @@
-version: "1.12";
-assetIndex: "1.12"; # 1.7.10+ only
-
-# Runtime-dependent params
-dir: "XXXXX";
-assetDir: "asset1.12";
-
-# Client params
-sortIndex: 0;
-title: "XXXXX";
-serverAddress: "server.tld";
-serverPort: 25565;
-
-# Updater and client watch service
-updateFastCheck: true;
-update: [
- "servers\\.dat"
-];
-updateVerify: [
- "libraries", "natives", "mods",
- "minecraft\\.jar", "forge\\.jar", "liteloader\\.jar"
-];
-updateExclusions: [];
-
-# Client launcher params
-mainClass: "net.minecraft.launchwrapper.Launch";
-classPath: [ "forge.jar", "liteloader.jar", "minecraft.jar", "libraries" ];
-jvmArgs: [
- "-Dfml.ignorePatchDiscrepancies=true",
- "-Dfml.ignoreInvalidMinecraftCertificates=true",
-
- # Some options from Mojang's launcher
- "-XX:+UseConcMarkSweepGC",
- "-XX:+CMSIncrementalMode",
- "-XX:-UseAdaptiveSizePolicy",
- "-Xmn128M",
-
- # JVM Attach protection
- "-XX:+DisableAttachMechanism"
-];
-clientArgs: [
- "--tweakClass", "net.minecraftforge.fml.common.launcher.FMLTweaker",
- "--tweakClass", "com.mumfrey.liteloader.launch.LiteLoaderTweaker"
-];
diff --git a/LaunchServer/resources/launchserver/defaults/profile1.12.2.cfg b/LaunchServer/resources/launchserver/defaults/profile1.12.2.cfg
new file mode 100644
index 0000000..af7aa50
--- /dev/null
+++ b/LaunchServer/resources/launchserver/defaults/profile1.12.2.cfg
@@ -0,0 +1,44 @@
+version: "1.12";
+assetIndex: "1.12"; # 1.7.10+ only
+
+# Runtime-dependent params
+dir: "XXXXX";
+assetDir: "asset1.12";
+
+# Client params
+sortIndex: 0;
+title: "XXXXX";
+serverAddress: "server.tld";
+serverPort: 25565;
+
+# Updater and client watch service
+updateFastCheck: true;
+update: [
+ "servers\\.dat"
+];
+updateVerify: [
+ "libraries", "natives", "mods",
+ "minecraft\\.jar", "forge\\.jar", "liteloader\\.jar"
+];
+updateExclusions: [];
+
+# Client launcher params
+mainClass: "net.minecraft.launchwrapper.Launch";
+classPath: [ "forge.jar", "liteloader.jar", "minecraft.jar", "libraries" ];
+jvmArgs: [
+ "-Dfml.ignorePatchDiscrepancies=true",
+ "-Dfml.ignoreInvalidMinecraftCertificates=true",
+
+ # Some options from Mojang's launcher
+ "-XX:+UseConcMarkSweepGC",
+ "-XX:+CMSIncrementalMode",
+ "-XX:-UseAdaptiveSizePolicy",
+ "-Xmn128M",
+
+ # JVM Attach protection
+ "-XX:+DisableAttachMechanism"
+];
+clientArgs: [
+ "--tweakClass", "net.minecraftforge.fml.common.launcher.FMLTweaker",
+ "--tweakClass", "com.mumfrey.liteloader.launch.LiteLoaderTweaker"
+];
diff --git a/LaunchServer/source/LaunchServer.java b/LaunchServer/source/LaunchServer.java
index 6ab8d46..2fa025c 100644
--- a/LaunchServer/source/LaunchServer.java
+++ b/LaunchServer/source/LaunchServer.java
@@ -351,8 +351,8 @@
}
// Create new config
- Config newConfig;
LogHelper.info("Creating LaunchServer config");
+ Config newConfig;
try (BufferedReader reader = IOHelper.newReader(IOHelper.getResourceURL("launchserver/defaults/config.cfg"))) {
newConfig = new Config(TextConfigReader.read(reader, false));
}
diff --git a/LaunchServer/source/auth/handler/AuthHandler.java b/LaunchServer/source/auth/handler/AuthHandler.java
index 61b4593..364e9c8 100644
--- a/LaunchServer/source/auth/handler/AuthHandler.java
+++ b/LaunchServer/source/auth/handler/AuthHandler.java
@@ -11,6 +11,7 @@
import launcher.serialize.config.ConfigObject;
import launcher.serialize.config.entry.BlockConfigEntry;
import launchserver.auth.AuthException;
+import launchserver.auth.provider.AuthProviderResult;
public abstract class AuthHandler extends ConfigObject implements AutoCloseable {
private static final Map> AUTH_HANDLERS = new ConcurrentHashMap<>(4);
@@ -24,7 +25,7 @@
public abstract void close() throws IOException;
@LauncherAPI
- public abstract UUID auth(String username, String accessToken) throws IOException;
+ public abstract UUID auth(AuthProviderResult authResult) throws IOException;
@LauncherAPI
public abstract UUID checkServer(String username, String serverID) throws IOException;
diff --git a/LaunchServer/source/auth/handler/CachedAuthHandler.java b/LaunchServer/source/auth/handler/CachedAuthHandler.java
index 4d6f478..5da02ca 100644
--- a/LaunchServer/source/auth/handler/CachedAuthHandler.java
+++ b/LaunchServer/source/auth/handler/CachedAuthHandler.java
@@ -11,10 +11,11 @@
import launcher.helper.SecurityHelper;
import launcher.request.auth.JoinServerRequest;
import launcher.serialize.config.entry.BlockConfigEntry;
+import launchserver.auth.provider.AuthProviderResult;
public abstract class CachedAuthHandler extends AuthHandler {
- private final Map entryCache = new HashMap<>();
- private final Map usernamesCache = new HashMap<>();
+ private final Map entryCache = new HashMap<>(1024);
+ private final Map usernamesCache = new HashMap<>(1024);
@LauncherAPI
protected CachedAuthHandler(BlockConfigEntry block) {
@@ -22,15 +23,15 @@
}
@Override
- public final synchronized UUID auth(String username, String accessToken) throws IOException {
- Entry entry = getEntry(username);
- if (entry == null || !updateAuth(entry.uuid, entry.username, accessToken)) {
- return authError(String.format("UUID is null for username '%s'", username));
+ public final synchronized UUID auth(AuthProviderResult result) throws IOException {
+ Entry entry = getEntry(result.username);
+ if (entry == null || !updateAuth(entry.uuid, entry.username, result.accessToken)) {
+ return authError(String.format("UUID is null for username '%s'", result.username));
}
// Update cached access token (and username case)
- entry.username = username;
- entry.accessToken = accessToken;
+ entry.username = result.username;
+ entry.accessToken = result.accessToken;
entry.serverID = null;
return entry.uuid;
}
diff --git a/LaunchServer/source/auth/handler/FileAuthHandler.java b/LaunchServer/source/auth/handler/FileAuthHandler.java
index da3dc25..a480bad 100644
--- a/LaunchServer/source/auth/handler/FileAuthHandler.java
+++ b/LaunchServer/source/auth/handler/FileAuthHandler.java
@@ -24,6 +24,7 @@
import launcher.serialize.config.entry.BooleanConfigEntry;
import launcher.serialize.config.entry.StringConfigEntry;
import launcher.serialize.stream.StreamObject;
+import launchserver.auth.provider.AuthProviderResult;
public abstract class FileAuthHandler extends AuthHandler {
@LauncherAPI public final Path file;
@@ -57,24 +58,24 @@
}
@Override
- public final UUID auth(String username, String accessToken) {
+ public final UUID auth(AuthProviderResult authResult) {
lock.writeLock().lock();
try {
- UUID uuid = usernameToUUID(username);
+ UUID uuid = usernameToUUID(authResult.username);
Entry entry = entryMap.get(uuid);
// Not registered? Fix it!
if (entry == null) {
- entry = new Entry(username);
+ entry = new Entry(authResult.username);
// Generate UUID
- uuid = genUUIDFor(username);
+ uuid = genUUIDFor(authResult.username);
entryMap.put(uuid, entry);
- usernamesMap.put(CommonHelper.low(username), uuid);
+ usernamesMap.put(CommonHelper.low(authResult.username), uuid);
}
// Authenticate
- entry.auth(username, accessToken);
+ entry.auth(authResult.username, authResult.accessToken);
return uuid;
} finally {
lock.writeLock().unlock();
diff --git a/LaunchServer/source/auth/handler/NullAuthHandler.java b/LaunchServer/source/auth/handler/NullAuthHandler.java
index facb569..a12a3f7 100644
--- a/LaunchServer/source/auth/handler/NullAuthHandler.java
+++ b/LaunchServer/source/auth/handler/NullAuthHandler.java
@@ -7,6 +7,7 @@
import launcher.LauncherAPI;
import launcher.helper.VerifyHelper;
import launcher.serialize.config.entry.BlockConfigEntry;
+import launchserver.auth.provider.AuthProviderResult;
public final class NullAuthHandler extends AuthHandler {
private volatile AuthHandler handler;
@@ -16,8 +17,8 @@
}
@Override
- public UUID auth(String username, String accessToken) throws IOException {
- return getHandler().auth(username, accessToken);
+ public UUID auth(AuthProviderResult authResult) throws IOException {
+ return getHandler().auth(authResult);
}
@Override
diff --git a/LaunchServer/source/auth/provider/AcceptAuthProvider.java b/LaunchServer/source/auth/provider/AcceptAuthProvider.java
index c6f39d3..457cf72 100644
--- a/LaunchServer/source/auth/provider/AcceptAuthProvider.java
+++ b/LaunchServer/source/auth/provider/AcceptAuthProvider.java
@@ -1,5 +1,6 @@
package launchserver.auth.provider;
+import launcher.helper.SecurityHelper;
import launcher.serialize.config.entry.BlockConfigEntry;
public final class AcceptAuthProvider extends AuthProvider {
@@ -8,8 +9,8 @@
}
@Override
- public String auth(String login, String password, String ip) {
- return login; // Same as login
+ public AuthProviderResult auth(String login, String password, String ip) {
+ return new AuthProviderResult(login, SecurityHelper.randomStringToken()); // Same as login
}
@Override
diff --git a/LaunchServer/source/auth/provider/AuthProvider.java b/LaunchServer/source/auth/provider/AuthProvider.java
index 10b1314..2fdbf0d 100644
--- a/LaunchServer/source/auth/provider/AuthProvider.java
+++ b/LaunchServer/source/auth/provider/AuthProvider.java
@@ -23,10 +23,10 @@
public abstract void close() throws IOException;
@LauncherAPI
- public abstract String auth(String login, String password, String ip) throws Exception;
+ public abstract AuthProviderResult auth(String login, String password, String ip) throws Exception;
@LauncherAPI
- public static String authError(String message) throws AuthException {
+ public static AuthProviderResult authError(String message) throws AuthException {
throw new AuthException(message);
}
@@ -50,6 +50,7 @@
registerProvider("reject", RejectAuthProvider::new);
// Auth providers that doesn't do nothing :D
+ registerProvider("mojang", MojangAuthProvider::new);
registerProvider("mysql", MySQLAuthProvider::new);
registerProvider("file", FileAuthProvider::new);
registerProvider("request", RequestAuthProvider::new);
diff --git a/LaunchServer/source/auth/provider/AuthProviderResult.java b/LaunchServer/source/auth/provider/AuthProviderResult.java
new file mode 100644
index 0000000..c7be9dd
--- /dev/null
+++ b/LaunchServer/source/auth/provider/AuthProviderResult.java
@@ -0,0 +1,11 @@
+package launchserver.auth.provider;
+
+public class AuthProviderResult {
+ public final String username;
+ public final String accessToken;
+
+ public AuthProviderResult(String username, String accessToken) {
+ this.username = username;
+ this.accessToken = accessToken;
+ }
+}
diff --git a/LaunchServer/source/auth/provider/FileAuthProvider.java b/LaunchServer/source/auth/provider/FileAuthProvider.java
index 5e0e135..e8b991a 100644
--- a/LaunchServer/source/auth/provider/FileAuthProvider.java
+++ b/LaunchServer/source/auth/provider/FileAuthProvider.java
@@ -11,6 +11,7 @@
import launcher.helper.CommonHelper;
import launcher.helper.IOHelper;
import launcher.helper.LogHelper;
+import launcher.helper.SecurityHelper;
import launcher.helper.VerifyHelper;
import launcher.serialize.config.ConfigObject;
import launcher.serialize.config.TextConfigReader;
@@ -40,7 +41,7 @@
}
@Override
- public String auth(String login, String password, String ip) throws IOException {
+ public AuthProviderResult auth(String login, String password, String ip) throws IOException {
Entry entry;
synchronized (cacheLock) {
updateCache();
@@ -52,7 +53,9 @@
if (entry == null || entry.ip != null && !entry.ip.equals(ip)) {
authError("Authentication from this IP is not allowed");
}
- return entry.username;
+
+ // We're done
+ return new AuthProviderResult(entry.username, SecurityHelper.randomStringToken());
}
@Override
diff --git a/LaunchServer/source/auth/provider/MojangAuthProvider.java b/LaunchServer/source/auth/provider/MojangAuthProvider.java
new file mode 100644
index 0000000..0532baa
--- /dev/null
+++ b/LaunchServer/source/auth/provider/MojangAuthProvider.java
@@ -0,0 +1,90 @@
+package launchserver.auth.provider;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.UUID;
+import java.util.regex.Pattern;
+
+import com.eclipsesource.json.Json;
+import com.eclipsesource.json.JsonObject;
+import com.eclipsesource.json.JsonValue;
+import com.eclipsesource.json.WriterConfig;
+import launcher.helper.IOHelper;
+import launcher.serialize.config.entry.BlockConfigEntry;
+
+public final class MojangAuthProvider extends AuthProvider {
+ private static final Pattern UUID_REGEX = Pattern.compile("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})");
+ private static final URL URL;
+
+ public MojangAuthProvider(BlockConfigEntry block) {
+ super(block);
+ }
+
+ @Override
+ public AuthProviderResult auth(String login, String password, String ip) throws Exception {
+ JsonObject request = Json.object().
+ add("agent", Json.object().add("name", "Minecraft").add("version", 1)).
+ add("username", login).add("password", password);
+
+ // Verify there's no error
+ JsonObject response = makeJSONRequest(URL, request);
+ if (response == null) {
+ authError("Empty mojang response");
+ }
+ JsonValue errorMessage = response.get("errorMessage");
+ if (errorMessage != null) {
+ authError(errorMessage.asString());
+ }
+
+ // Parse JSON data
+ JsonObject selectedProfile = response.get("selectedProfile").asObject();
+ String username = selectedProfile.get("name").asString();
+ String accessToken = response.get("clientToken").asString();
+ UUID uuid = UUID.fromString(UUID_REGEX.matcher(selectedProfile.get("id").asString()).replaceFirst("$1-$2-$3-$4-$5"));
+ String launcherToken = response.get("accessToken").asString();
+
+ // We're done
+ return new MojangAuthProviderResult(username, accessToken, uuid, launcherToken);
+ }
+
+ @Override
+ public void close() {
+ // Do nothing
+ }
+
+ public static JsonObject makeJSONRequest(URL url, JsonObject request) throws IOException {
+ // Make authentication request
+ HttpURLConnection connection = IOHelper.newConnectionPost(url);
+ connection.setRequestProperty("Content-Type", "application/json");
+ try (OutputStream output = connection.getOutputStream()) {
+ output.write(request.toString(WriterConfig.MINIMAL).getBytes(StandardCharsets.UTF_8));
+ }
+ connection.getResponseCode(); // Actually make request
+
+ // Read response
+ InputStream errorInput = connection.getErrorStream();
+ try (InputStream input = errorInput == null ? connection.getInputStream() : errorInput) {
+ String charset = connection.getContentEncoding();
+ Charset charsetObject = charset == null ?
+ IOHelper.UNICODE_CHARSET : Charset.forName(charset);
+
+ // Parse response
+ String json = new String(IOHelper.read(input), charsetObject);
+ return json.isEmpty() ? null : Json.parse(json).asObject();
+ }
+ }
+
+ static {
+ try {
+ URL = new URL("https://authserver.mojang.com/authenticate");
+ } catch (MalformedURLException e) {
+ throw new InternalError(e);
+ }
+ }
+}
diff --git a/LaunchServer/source/auth/provider/MojangAuthProviderResult.java b/LaunchServer/source/auth/provider/MojangAuthProviderResult.java
new file mode 100644
index 0000000..aee029d
--- /dev/null
+++ b/LaunchServer/source/auth/provider/MojangAuthProviderResult.java
@@ -0,0 +1,14 @@
+package launchserver.auth.provider;
+
+import java.util.UUID;
+
+public final class MojangAuthProviderResult extends AuthProviderResult {
+ public final UUID uuid;
+ public final String launcherToken;
+
+ public MojangAuthProviderResult(String username, String accessToken, UUID uuid, String launcherToken) {
+ super(username, accessToken);
+ this.uuid = uuid;
+ this.launcherToken = launcherToken;
+ }
+}
diff --git a/LaunchServer/source/auth/provider/MySQLAuthProvider.java b/LaunchServer/source/auth/provider/MySQLAuthProvider.java
index 4d7bb5f..7a95aa5 100644
--- a/LaunchServer/source/auth/provider/MySQLAuthProvider.java
+++ b/LaunchServer/source/auth/provider/MySQLAuthProvider.java
@@ -6,6 +6,7 @@
import java.sql.SQLException;
import launcher.helper.CommonHelper;
+import launcher.helper.SecurityHelper;
import launcher.helper.VerifyHelper;
import launcher.serialize.config.entry.BlockConfigEntry;
import launcher.serialize.config.entry.ListConfigEntry;
@@ -30,7 +31,7 @@
}
@Override
- public String auth(String login, String password, String ip) throws SQLException, AuthException {
+ public AuthProviderResult auth(String login, String password, String ip) throws SQLException, AuthException {
try (Connection c = mySQLHolder.getConnection(); PreparedStatement s = c.prepareStatement(query)) {
String[] replaceParams = { "login", login, "password", password, "ip", ip };
for (int i = 0; i < queryParams.length; i++) {
@@ -40,7 +41,7 @@
// Execute SQL query
s.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
try (ResultSet set = s.executeQuery()) {
- return set.next() ? set.getString(1) : authError("Incorrect username or password");
+ return set.next() ? new AuthProviderResult(set.getString(1), SecurityHelper.randomStringToken()) : authError("Incorrect username or password");
}
}
}
diff --git a/LaunchServer/source/auth/provider/NullAuthProvider.java b/LaunchServer/source/auth/provider/NullAuthProvider.java
index 5c5aa81..baf9edc 100644
--- a/LaunchServer/source/auth/provider/NullAuthProvider.java
+++ b/LaunchServer/source/auth/provider/NullAuthProvider.java
@@ -15,7 +15,7 @@
}
@Override
- public String auth(String login, String password, String ip) throws Exception {
+ public AuthProviderResult auth(String login, String password, String ip) throws Exception {
return getProvider().auth(login, password, ip);
}
diff --git a/LaunchServer/source/auth/provider/RejectAuthProvider.java b/LaunchServer/source/auth/provider/RejectAuthProvider.java
index 8a08b08..d16c65e 100644
--- a/LaunchServer/source/auth/provider/RejectAuthProvider.java
+++ b/LaunchServer/source/auth/provider/RejectAuthProvider.java
@@ -15,7 +15,7 @@
}
@Override
- public String auth(String login, String password, String ip) throws AuthException {
+ public AuthProviderResult auth(String login, String password, String ip) throws AuthException {
return authError(message);
}
diff --git a/LaunchServer/source/auth/provider/RequestAuthProvider.java b/LaunchServer/source/auth/provider/RequestAuthProvider.java
index 5fb9a3f..a360ad0 100644
--- a/LaunchServer/source/auth/provider/RequestAuthProvider.java
+++ b/LaunchServer/source/auth/provider/RequestAuthProvider.java
@@ -7,6 +7,7 @@
import launcher.helper.CommonHelper;
import launcher.helper.IOHelper;
+import launcher.helper.SecurityHelper;
import launcher.serialize.config.entry.BlockConfigEntry;
import launcher.serialize.config.entry.StringConfigEntry;
@@ -24,13 +25,14 @@
}
@Override
- public String auth(String login, String password, String ip) throws IOException {
+ public AuthProviderResult auth(String login, String password, String ip) throws IOException {
String currentResponse = IOHelper.request(new URL(getFormattedURL(login, password, ip)));
// Match username
Matcher matcher = response.matcher(currentResponse);
return matcher.matches() && matcher.groupCount() >= 1 ?
- matcher.group("username") : authError(currentResponse);
+ new AuthProviderResult(matcher.group("username"), SecurityHelper.randomStringToken()) :
+ authError(currentResponse);
}
@Override
diff --git a/LaunchServer/source/command/auth/AuthCommand.java b/LaunchServer/source/command/auth/AuthCommand.java
index 0c5f371..aeaf10c 100644
--- a/LaunchServer/source/command/auth/AuthCommand.java
+++ b/LaunchServer/source/command/auth/AuthCommand.java
@@ -3,8 +3,8 @@
import java.util.UUID;
import launcher.helper.LogHelper;
-import launcher.helper.SecurityHelper;
import launchserver.LaunchServer;
+import launchserver.auth.provider.AuthProviderResult;
import launchserver.command.Command;
public final class AuthCommand extends Command {
@@ -29,13 +29,10 @@
String password = args[1];
// Authenticate
- String username = server.config.authProvider.auth(login, password, "127.0.0.1");
-
- // Authenticate on server (and get UUID)
- String accessToken = SecurityHelper.randomStringToken();
- UUID uuid = server.config.authHandler.auth(username, accessToken);
+ AuthProviderResult result = server.config.authProvider.auth(login, password, "127.0.0.1");
+ UUID uuid = server.config.authHandler.auth(result);
// Print auth successful message
- LogHelper.subInfo("UUID: %s, Username: '%s', Access Token: '%s'", uuid, username, accessToken);
+ LogHelper.subInfo("UUID: %s, Username: '%s', Access Token: '%s'", uuid, result.username, result.accessToken);
}
}
diff --git a/LaunchServer/source/response/auth/AuthResponse.java b/LaunchServer/source/response/auth/AuthResponse.java
index 32ff8e3..5d65754 100644
--- a/LaunchServer/source/response/auth/AuthResponse.java
+++ b/LaunchServer/source/response/auth/AuthResponse.java
@@ -14,6 +14,7 @@
import launchserver.LaunchServer;
import launchserver.auth.AuthException;
import launchserver.auth.provider.AuthProvider;
+import launchserver.auth.provider.AuthProviderResult;
import launchserver.response.Response;
import launchserver.response.profile.ProfileByUUIDResponse;
@@ -42,11 +43,11 @@
// Authenticate
debug("Login: '%s', Password: '%s'", login, echo(password.length()));
- String username;
+ AuthProviderResult result;
try {
- username = server.config.authProvider.auth(login, password, ip);
- if (!VerifyHelper.isValidUsername(username)) {
- AuthProvider.authError(String.format("Illegal username: '%s'", username));
+ result = server.config.authProvider.auth(login, password, ip);
+ if (!VerifyHelper.isValidUsername(result.username)) {
+ AuthProvider.authError(String.format("Illegal result: '%s'", result.username));
return;
}
} catch (AuthException e) {
@@ -57,13 +58,12 @@
requestError("Internal auth provider error");
return;
}
- debug("Auth: '%s' -> '%s'", login, username);
+ debug("Auth: '%s' -> '%s', '%s'", login, result.username, result.accessToken);
// Authenticate on server (and get UUID)
- String accessToken = SecurityHelper.randomStringToken();
UUID uuid;
try {
- uuid = server.config.authHandler.auth(username, accessToken);
+ uuid = server.config.authHandler.auth(result);
} catch (AuthException e) {
requestError(e.getMessage());
return;
@@ -75,8 +75,8 @@
writeNoError(output);
// Write profile and UUID
- ProfileByUUIDResponse.getProfile(server, uuid, username).write(output);
- output.writeASCII(accessToken, -SecurityHelper.TOKEN_STRING_LENGTH);
+ ProfileByUUIDResponse.getProfile(server, uuid, result.username).write(output);
+ output.writeASCII(result.accessToken, -SecurityHelper.TOKEN_STRING_LENGTH);
}
private static String echo(int length) {
diff --git a/Launcher/source/client/ClientProfile.java b/Launcher/source/client/ClientProfile.java
index e9cff77..908af3d 100644
--- a/Launcher/source/client/ClientProfile.java
+++ b/Launcher/source/client/ClientProfile.java
@@ -206,7 +206,7 @@
MC194("1.9.4", 110),
MC1102("1.10.2", 210),
MC1112("1.11.2", 316),
- MC1121("1.12.1", 338);
+ MC1122("1.12.2", 340);
private static final Map VERSIONS;
public final String name;
public final int protocol;
diff --git a/Launcher/source/helper/IOHelper.java b/Launcher/source/helper/IOHelper.java
index e42b2b7..e18c1d9 100644
--- a/Launcher/source/helper/IOHelper.java
+++ b/Launcher/source/helper/IOHelper.java
@@ -266,6 +266,14 @@
}
@LauncherAPI
+ public static HttpURLConnection newConnectionPost(URL url) throws IOException {
+ HttpURLConnection connection = (HttpURLConnection) newConnection(url);
+ connection.setDoOutput(true);
+ connection.setRequestMethod("POST");
+ return connection;
+ }
+
+ @LauncherAPI
public static Deflater newDeflater() {
Deflater deflater = new Deflater(Deflater.DEFAULT_COMPRESSION, true);
deflater.setStrategy(Deflater.DEFAULT_STRATEGY);
diff --git a/compat/BungeeCord.patch b/compat/BungeeCord.patch
index 74f45a4..af020e8 100644
--- a/compat/BungeeCord.patch
+++ b/compat/BungeeCord.patch
@@ -3,7 +3,7 @@
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
---- bootstrap/pom.xml (revision ef326dba192fe532dc6509e0975266715da5ccea)
+--- bootstrap/pom.xml (revision 4c84f37fd23dfd67e4fee5dfd7cb62d67791129f)
+++ bootstrap/pom.xml (revision )
@@ -50,7 +50,8 @@
@@ -20,7 +20,7 @@
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
---- proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java (revision ef326dba192fe532dc6509e0975266715da5ccea)
+--- proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java (revision 4c84f37fd23dfd67e4fee5dfd7cb62d67791129f)
+++ proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java (revision )
@@ -2,6 +2,7 @@
@@ -123,7 +123,7 @@
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
---- bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java (revision ef326dba192fe532dc6509e0975266715da5ccea)
+--- bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java (revision 4c84f37fd23dfd67e4fee5dfd7cb62d67791129f)
+++ bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java (revision )
@@ -5,9 +5,9 @@
@@ -142,7 +142,7 @@
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
---- proxy/src/main/java/net/md_5/bungee/connection/LoginResult.java (revision ef326dba192fe532dc6509e0975266715da5ccea)
+--- proxy/src/main/java/net/md_5/bungee/connection/LoginResult.java (revision 4c84f37fd23dfd67e4fee5dfd7cb62d67791129f)
+++ proxy/src/main/java/net/md_5/bungee/connection/LoginResult.java (revision )
@@ -1,5 +1,6 @@
package net.md_5.bungee.connection;
@@ -167,7 +167,7 @@
+ properties[index++] = new Property(CompatProfile.SKIN_DIGEST_PROPERTY, profile.skinDigest, "");
+ }
+ if (profile.cloakURL != null) {
-+ properties[index++] = new Property(CompatProfile.CLOAK_URL_PROPERTY, profile.cloakDigest, "");
++ properties[index++] = new Property(CompatProfile.CLOAK_URL_PROPERTY, profile.cloakURL, "");
+ }
+ if (profile.cloakDigest != null) {
+ properties[index++] = new Property(CompatProfile.CLOAK_DIGEST_PROPERTY, profile.cloakDigest, "");
@@ -182,12 +182,12 @@
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
---- pom.xml (revision ef326dba192fe532dc6509e0975266715da5ccea)
+--- pom.xml (revision 4c84f37fd23dfd67e4fee5dfd7cb62d67791129f)
+++ pom.xml (revision )
-@@ -67,8 +67,8 @@
+@@ -68,8 +68,8 @@
unknown
- 4.1.15.Final
+ 4.1.17.Final
- 1.7
- 1.7
+ 1.8
@@ -195,7 +195,7 @@
UTF-8
-@@ -96,6 +96,13 @@
+@@ -97,6 +97,13 @@
lombok
1.16.16
provided