Warn if using HTTP

This commit is contained in:
yushijinhun 2018-10-05 18:36:16 +08:00
parent eebacfa567
commit 8dadd210fc
No known key found for this signature in database
GPG key ID: 5BC167F73EA558E4

View file

@ -99,6 +99,7 @@ public final class AuthlibInjector {
String apiRoot = System.getProperty(PROP_API_ROOT);
if (apiRoot == null) return empty();
Logging.CONFIG.info("API root: " + apiRoot);
warnIfHttp(apiRoot);
String metadataResponse;
@ -138,6 +139,12 @@ public final class AuthlibInjector {
return of(configuration);
}
private static void warnIfHttp(String url) {
if (url.toLowerCase().startsWith("http://")) {
Logging.CONFIG.warning("You are using HTTP protocol, which is INSECURE! Please switch to HTTPS if possible.");
}
}
private static ClassTransformer createTransformer(YggdrasilConfiguration config) {
ClassTransformer transformer = new ClassTransformer();
transformer.debugSaveClass = "true".equals(System.getProperty(PROP_DUMP_CLASS));