Added 'Webserver.Security.Disable_authentication' setting.

This is a feature flag to not have authentication even when
https has been enabled.

Affects issues:
- Close #1264
This commit is contained in:
Rsl1122 2020-01-21 16:33:29 +02:00
parent c6416254e9
commit 380f848f62
5 changed files with 11 additions and 2 deletions

View File

@ -137,8 +137,10 @@ public class WebServer implements SubSystem {
logger.log(L.INFO_COLOR, "§e" + locale.getString(PluginLang.WEB_SERVER_NOTIFY_HTTP_USER_AUTH));
server = HttpServer.create(new InetSocketAddress(config.get(WebserverSettings.INTERNAL_IP), port), 10);
} else if (server == null) {
logger.log(L.INFO_COLOR, "§eWebServer: Proxy HTTPS Override enabled. HTTP Server in use, make sure that your Proxy webserver is routing with HTTPS and AlternativeIP.Link points to the Proxy");
logger.log(L.INFO_COLOR, "§e" + locale.getString(PluginLang.WEB_SERVER_NOTIFY_USING_PROXY_MODE));
server = HttpServer.create(new InetSocketAddress(config.get(WebserverSettings.INTERNAL_IP), port), 10);
} else if (config.isTrue(WebserverSettings.DISABLED_AUTHENTICATION)) {
logger.info(locale.getString(PluginLang.WEB_SERVER_NOTIFY_HTTPS_USER_AUTH));
}
server.createContext("/", requestHandler);
@ -295,7 +297,7 @@ public class WebServer implements SubSystem {
}
public boolean isAuthRequired() {
return isUsingHTTPS();
return isUsingHTTPS() && config.isFalse(WebserverSettings.DISABLED_AUTHENTICATION);
}
public String getAccessAddress() {

View File

@ -38,6 +38,7 @@ public class WebserverSettings {
public static final Setting<String> CERTIFICATE_STOREPASS = new StringSetting("Webserver.Security.SSL_certificate.Store_pass");
public static final Setting<String> CERTIFICATE_ALIAS = new StringSetting("Webserver.Security.SSL_certificate.Alias");
public static final Setting<Boolean> DISABLED = new BooleanSetting("Webserver.Disable_Webserver");
public static final Setting<Boolean> DISABLED_AUTHENTICATION = new BooleanSetting("Webserver.Security.Disable_authentication");
public static final Setting<String> EXTERNAL_LINK = new StringSetting("Webserver.External_Webserver_address");
private WebserverSettings() {

View File

@ -42,7 +42,9 @@ public enum PluginLang implements Lang {
WEB_SERVER_FAIL_STORE_LOAD("WebServer FAIL - Store Load", "WebServer: SSL Certificate loading Failed."),
WEB_SERVER_NOTIFY_NO_CERT_FILE("WebServer - Notify no Cert file", "WebServer: Certificate KeyStore File not Found: ${0}"),
WEB_SERVER_NOTIFY_HTTP("WebServer - Notify HTTP", "WebServer: No Certificate -> Using HTTP-server for Visualization."),
WEB_SERVER_NOTIFY_USING_PROXY_MODE("WebServer - Notify Using Proxy", "WebServer: Proxy-mode HTTPS enabled, make sure that your reverse-proxy is routing using HTTPS and Plan AlternativeIP.Link points to the Proxy"),
WEB_SERVER_NOTIFY_HTTP_USER_AUTH("WebServer - Notify HTTP User Auth", "WebServer: User Authorization Disabled! (Not secure over HTTP)"),
WEB_SERVER_NOTIFY_HTTPS_USER_AUTH("WebServer - Notify HTTPS User Auth", "WebServer: User Authorization Disabled! (Disabled in config)"),
DISABLED("Disable", "Player Analytics Disabled."),
DISABLED_WEB_SERVER("Disable - WebServer", "Webserver has been disabled."),

View File

@ -50,6 +50,8 @@ Webserver:
Key_pass: default
Store_pass: default
Alias: alias
# HTTPS is required for Login.
Disable_authentication: false
# Cross-Origin Resource Sharing (Requests from non-Plan web pages)
# https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
CORS:

View File

@ -52,6 +52,8 @@ Webserver:
Key_pass: default
Store_pass: default
Alias: alias
# HTTPS is required for Login.
Disable_authentication: false
# Cross-Origin Resource Sharing (Requests from non-Plan web pages)
# https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
CORS: