Fix Keystore

This commit is contained in:
Rsl1122 2017-08-01 00:46:10 +03:00
parent 91297a691b
commit e0d24b4517
3 changed files with 6 additions and 3 deletions

View File

@ -48,7 +48,7 @@ public enum Settings {
ANALYSIS_EXPORT_PATH("Settings.Analysis.Export.DestinationFolder"),
WEBSERVER_CERTIFICATE_PATH("Settings.WebServer.Security.Certificate.KeyStorePath"),
WEBSERVER_CERTIFICATE_KEYPASS("Settings.WebServer.Security.Certificate.KeyPass"),
WEBSERVER_CERTIFICATE_STOREPASS("Settings.WebServer.Security.Certificate.KeyPass"),
WEBSERVER_CERTIFICATE_STOREPASS("Settings.WebServer.Security.Certificate.StorePass"),
WEBSERVER_CERTIFICATE_ALIAS("Settings.WebServer.Security.Certificate.Alias"),
LINK_PROTOCOL("Settings.WebServer.ExternalWebServerLinkProtocol"),
//

View File

@ -72,6 +72,7 @@ public class WebServer {
Log.debug(usingHttps ? "Https Start Successful." : "Https Start Failed.");
if (!usingHttps) {
Log.infoColor(ChatColor.YELLOW + "User Authorization Disabled! (Not possible over http)");
server = HttpServer.create(new InetSocketAddress(port), 10);
}
@ -171,7 +172,7 @@ public class WebServer {
private boolean startHttpsServer() throws IOException {
String keyStorePath = Settings.WEBSERVER_CERTIFICATE_PATH.toString();
if (!Paths.get(keyStorePath).isAbsolute()) {
keyStorePath = plugin.getDataFolder() + keyStorePath;
keyStorePath = plugin.getDataFolder() + File.separator + keyStorePath;
}
char[] storepass = Settings.WEBSERVER_CERTIFICATE_STOREPASS.toString().toCharArray();
char[] keypass = Settings.WEBSERVER_CERTIFICATE_KEYPASS.toString().toCharArray();
@ -216,7 +217,9 @@ public class WebServer {
} catch (FileNotFoundException e) {
Log.infoColor(ChatColor.YELLOW + "WebServer: SSL Certificate KeyStore File not Found: " + keyStorePath);
Log.info("No Certificate -> Using Http server for Visualization.");
Log.infoColor(ChatColor.YELLOW + "User Authorization Disabled! (Not possible over http)");
} catch (IOException e) {
Log.error("WebServer: " + e);
Log.toLog(this.getClass().getName(), e);
} catch (KeyStoreException | CertificateException | UnrecoverableKeyException e) {
Log.error("WebServer: SSL Certificate loading Failed.");
Log.toLog(this.getClass().getName(), e);