Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added HTTPS/SSL Support #68

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions spring-boot-admin-starter-client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/.classpath
/.project
/bin
/.apt_generated
/.factorypath
5 changes: 5 additions & 0 deletions spring-boot-admin-starter-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ private String getHostname() {
}

private String createLocalUri(int port, String path) {
return append("http://" + getHostname() + ":" + port + "/", path);
String scheme = server.getSsl() != null && server.getSsl().isEnabled() ? "https" : "http";
return append(scheme + "://" + getHostname() + ":" + port + "/", path);
}

private String append(String uri, String path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ public void test_default() {
assertThat(clientProperties.getServiceUrl(), is("http://" + getHostname()
+ ":8080/"));
}

@Test
public void testSsl() {
load("server.ssl.key-store=somefile.jks", "server.ssl.key-store-password=password");
AdminClientProperties clientProperties = new AdminClientProperties();
context.getAutowireCapableBeanFactory().autowireBean(clientProperties);

publishServletContainerInitializedEvent(clientProperties, 8080, null);

assertThat(clientProperties.getManagementUrl(), is("https://" + getHostname()
+ ":8080/"));
assertThat(clientProperties.getHealthUrl(), is("https://" + getHostname()
+ ":8080/health/"));
assertThat(clientProperties.getServiceUrl(), is("https://" + getHostname()
+ ":8080/"));
}

private String getHostname() {
try {
Expand Down