Merge branch 'release/5.2.4'

This commit is contained in:
Gravita 2021-10-15 21:41:33 +07:00
commit 39bdab50ca
9 changed files with 37 additions and 16 deletions

View file

@ -72,7 +72,7 @@ public static void main(String[] args) throws Exception {
{
LauncherTrustManager.CheckClassResult result = certificateManager.checkClass(LaunchServer.class);
if (result.type == LauncherTrustManager.CheckClassResultType.SUCCESS) {
logger.info("LaunchServer signed by {}", result.endCertificate.getSubjectDN().getName());
logger.info("LaunchServer signed by {}", result.endCertificate.getSubjectX500Principal().getName());
} else if (result.type == LauncherTrustManager.CheckClassResultType.NOT_SIGNED) {
// None
} else {

View file

@ -306,7 +306,8 @@ public void invoke(String... args) throws Exception {
} else {
password = new AuthPlainPassword(plainPassword);
}
instance.registration(username, email, password, map);
User user = instance.registration(username, email, password, map);
logger.info("User '{}' registered", user.toString());
}
});
}

View file

@ -47,11 +47,11 @@ public void invoke(String... args) {
private void printCheckStatusInfo(LauncherTrustManager.CheckClassResult checkStatus) {
if (checkStatus != null && checkStatus.endCertificate != null) {
X509Certificate cert = checkStatus.endCertificate;
logger.info("[MODULE CERT] Module signer: {}", cert.getSubjectDN().getName());
logger.info("[MODULE CERT] Module signer: {}", cert.getSubjectX500Principal().getName());
}
if (checkStatus != null && checkStatus.rootCertificate != null) {
X509Certificate cert = checkStatus.rootCertificate;
logger.info("[MODULE CERT] Module signer CA: {}", cert.getSubjectDN().getName());
logger.info("[MODULE CERT] Module signer CA: {}", cert.getSubjectX500Principal().getName());
}
}
}

View file

@ -3,7 +3,9 @@
import io.jsonwebtoken.Jwts;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import pro.gravit.launcher.profiles.ClientProfile;
import pro.gravit.launchserver.LaunchServer;
import pro.gravit.launchserver.auth.AuthProviderPair;
import pro.gravit.launchserver.command.Command;
import pro.gravit.utils.command.SubCommand;
@ -20,11 +22,26 @@ public void invoke(String... args) throws Exception {
logger.info("Token: {}", claims.getBody());
}
});
this.childCommands.put("server", new SubCommand("[serverName] (authId)", "generate new server token") {
this.childCommands.put("server", new SubCommand("[profileName] (authId)", "generate new server token") {
@Override
public void invoke(String... args) throws Exception {
String token = server.authManager.newCheckServerToken(args[0], args.length > 1 ? args[1] : server.config.getAuthProviderPair().name);
logger.info("Token: {}", token);
AuthProviderPair pair = args.length > 1 ? server.config.getAuthProviderPair(args[1]) : server.config.getAuthProviderPair();
ClientProfile profile = null;
for(ClientProfile p : server.getProfiles()) {
if(p.getTitle().equals(args[0])) {
profile = p;
break;
}
}
if(profile == null) {
logger.warn("Profile {} not found", args[0]);
}
if(pair == null) {
logger.error("AuthId {} not found", args[1]);
return;
}
String token = server.authManager.newCheckServerToken(args[0], pair.name);
logger.info("Server token {} authId {}: {}", args[0], pair.name, token);
}
});
}

View file

@ -31,11 +31,13 @@ public void execute(ChannelHandlerContext ctx, Client pClient) {
try {
server.authHookManager.checkServerHook.hook(this, pClient);
AuthManager.CheckServerReport report = server.authManager.checkServer(pClient, username, serverID);
if (report != null) {
result.playerProfile = report.playerProfile;
result.uuid = report.uuid;
logger.debug("checkServer: {} uuid: {} serverID: {}", result.playerProfile == null ? null : result.playerProfile.username, result.uuid, serverID);
if(report == null) {
sendError("User not verified");
return;
}
result.playerProfile = report.playerProfile;
result.uuid = report.uuid;
logger.debug("checkServer: {} uuid: {} serverID: {}", result.playerProfile == null ? null : result.playerProfile.username, result.uuid, serverID);
} catch (AuthException | HookException e) {
sendError(e.getMessage());
return;

View file

@ -6,7 +6,7 @@ public final class Version implements Comparable<Version> {
public static final int MAJOR = 5;
public static final int MINOR = 2;
public static final int PATCH = 3;
public static final int PATCH = 4;
public static final int BUILD = 1;
public static final Version.Type RELEASE = Type.STABLE;
public final int major;

View file

@ -93,6 +93,7 @@ public ProfilesRequestEvent getProfiles() throws Exception {
return result;
}
@SuppressWarnings("ConfusingArgumentToVarargsMethod")
public void run(String... args) throws Throwable {
initGson();
AuthRequest.registerProviders();
@ -173,9 +174,9 @@ public void run(String... args) throws Throwable {
System.arraycopy(args, 1, real_args, 0, args.length - 1);
} else real_args = args;
mainMethod.invoke((Object) real_args);
mainMethod.invokeWithArguments(real_args);
} else {
mainMethod.invoke((Object) config.args.toArray(new String[0]));
mainMethod.invokeWithArguments(config.args.toArray(new String[0]));
}
}

View file

@ -5,7 +5,7 @@
id 'org.openjfx.javafxplugin' version '0.0.10' apply false
}
group = 'pro.gravit.launcher'
version = '5.2.3'
version = '5.2.4'
apply from: 'props.gradle'

@ -1 +1 @@
Subproject commit bfcab2ff667d9a53fdee2a9d2fd8d5246eb619b2
Subproject commit fd75e8dfa26a3103f03e4e6e6e3eb1c6e6a4ba1a