Commit fe4c0022 authored by Rob Winch's avatar Rob Winch Committed by Phillip Webb

Add a warning an HTTPS connection is not used

Update RemoteClientConfiguration to warn the user that they really
should be using HTTPS.

See gh-3087
parent bdf7663a
...@@ -89,6 +89,10 @@ public class RemoteClientConfiguration { ...@@ -89,6 +89,10 @@ public class RemoteClientConfiguration {
&& !remoteProperties.getRestart().isEnabled()) { && !remoteProperties.getRestart().isEnabled()) {
logger.warn("Remote restart and debug are both disabled."); logger.warn("Remote restart and debug are both disabled.");
} }
if (!this.remoteUrl.startsWith("https://")) {
logger.warn("The connection to " + this.remoteUrl
+ " is insecure. You should use a URL starting with 'https://'.");
}
} }
/** /**
......
...@@ -90,6 +90,12 @@ public class RemoteClientConfigurationTests { ...@@ -90,6 +90,12 @@ public class RemoteClientConfigurationTests {
containsString("Remote restart and debug are both disabled")); containsString("Remote restart and debug are both disabled"));
} }
@Test
public void warnIfNotHttps() throws Exception {
configureWithRemoteUrl("http://localhost");
assertThat(this.output.toString(), containsString("is insecure"));
}
@Test @Test
public void doesntWarnIfUsingHttps() throws Exception { public void doesntWarnIfUsingHttps() throws Exception {
configureWithRemoteUrl("https://localhost"); configureWithRemoteUrl("https://localhost");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment