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
This commit is contained in:
Rob Winch 2015-06-01 13:24:08 -07:00 committed by Phillip Webb
parent bdf7663a9a
commit fe4c0022d7
2 changed files with 10 additions and 0 deletions

View File

@ -89,6 +89,10 @@ public class RemoteClientConfiguration {
&& !remoteProperties.getRestart().isEnabled()) {
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://'.");
}
}
/**

View File

@ -90,6 +90,12 @@ public class RemoteClientConfigurationTests {
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
public void doesntWarnIfUsingHttps() throws Exception {
configureWithRemoteUrl("https://localhost");