Skip to content

Commit 77454a6

Browse files
committed
Merge pull request #45792 from shekharAggarwal
* pr/45792: Add SSL response structure to actuator info endpoint documentation Closes gh-45792
2 parents 7757049 + dcd3a23 commit 77454a6

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/info.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,13 @@ The following table describes the structure of the `java` section of the respons
7676

7777
[cols="2,1,3"]
7878
include::partial$rest/actuator/info/response-fields-beneath-java.adoc[]
79+
80+
81+
82+
[[info.retrieving.response-structure.ssl]]
83+
==== SSL Response Structure
84+
85+
The following table describes the structure of the `ssl` section of the response:
86+
87+
[cols="2,1,3"]
88+
include::partial$rest/actuator/info/response-fields-beneath-ssl.adoc[]

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointDocumentationTests.java

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.info;
1818

19+
import java.time.Duration;
1920
import java.time.Instant;
2021
import java.util.List;
2122
import java.util.Properties;
@@ -30,8 +31,15 @@
3031
import org.springframework.boot.actuate.info.JavaInfoContributor;
3132
import org.springframework.boot.actuate.info.OsInfoContributor;
3233
import org.springframework.boot.actuate.info.ProcessInfoContributor;
34+
import org.springframework.boot.actuate.info.SslInfoContributor;
3335
import org.springframework.boot.info.BuildProperties;
3436
import org.springframework.boot.info.GitProperties;
37+
import org.springframework.boot.info.SslInfo;
38+
import org.springframework.boot.ssl.DefaultSslBundleRegistry;
39+
import org.springframework.boot.ssl.SslBundle;
40+
import org.springframework.boot.ssl.SslStoreBundle;
41+
import org.springframework.boot.ssl.jks.JksSslStoreBundle;
42+
import org.springframework.boot.ssl.jks.JksSslStoreDetails;
3543
import org.springframework.context.annotation.Bean;
3644
import org.springframework.context.annotation.Configuration;
3745
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
@@ -55,7 +63,7 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
5563
void info() {
5664
assertThat(this.mvc.get().uri("/actuator/info")).hasStatusOk()
5765
.apply(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo(),
58-
javaInfo()));
66+
javaInfo(), sslInfo()));
5967
}
6068

6169
private ResponseFieldsSnippet gitInfo() {
@@ -142,6 +150,45 @@ private ResponseFieldsSnippet javaInfo() {
142150
.optional());
143151
}
144152

153+
private ResponseFieldsSnippet sslInfo() {
154+
return responseFields(beneathPath("ssl"),
155+
fieldWithPath("bundles").description("SSL bundles information.").type(JsonFieldType.ARRAY),
156+
fieldWithPath("bundles[].name").description("Name of the SSL bundle.").type(JsonFieldType.STRING),
157+
fieldWithPath("bundles[].certificateChains").description("Certificate chains in the bundle.")
158+
.type(JsonFieldType.ARRAY),
159+
fieldWithPath("bundles[].certificateChains[].alias").description("Alias of the certificate chain.")
160+
.type(JsonFieldType.STRING),
161+
fieldWithPath("bundles[].certificateChains[].certificates").description("Certificates in the chain.")
162+
.type(JsonFieldType.ARRAY),
163+
fieldWithPath("bundles[].certificateChains[].certificates[].subject")
164+
.description("Subject of the certificate.")
165+
.type(JsonFieldType.STRING),
166+
fieldWithPath("bundles[].certificateChains[].certificates[].version")
167+
.description("Version of the certificate.")
168+
.type(JsonFieldType.STRING),
169+
fieldWithPath("bundles[].certificateChains[].certificates[].issuer")
170+
.description("Issuer of the certificate.")
171+
.type(JsonFieldType.STRING),
172+
fieldWithPath("bundles[].certificateChains[].certificates[].validityStarts")
173+
.description("Certificate validity start date.")
174+
.type(JsonFieldType.STRING),
175+
fieldWithPath("bundles[].certificateChains[].certificates[].serialNumber")
176+
.description("Serial number of the certificate.")
177+
.type(JsonFieldType.STRING),
178+
fieldWithPath("bundles[].certificateChains[].certificates[].validityEnds")
179+
.description("Certificate validity end date.")
180+
.type(JsonFieldType.STRING),
181+
fieldWithPath("bundles[].certificateChains[].certificates[].validity")
182+
.description("Certificate validity information.")
183+
.type(JsonFieldType.OBJECT),
184+
fieldWithPath("bundles[].certificateChains[].certificates[].validity.status")
185+
.description("Certificate validity status.")
186+
.type(JsonFieldType.STRING),
187+
fieldWithPath("bundles[].certificateChains[].certificates[].signatureAlgorithmName")
188+
.description("Signature algorithm name.")
189+
.type(JsonFieldType.STRING));
190+
}
191+
145192
@Configuration(proxyBeanMethods = false)
146193
static class TestConfiguration {
147194

@@ -186,6 +233,21 @@ JavaInfoContributor javaInfoContributor() {
186233
return new JavaInfoContributor();
187234
}
188235

236+
@Bean
237+
SslInfo sslInfo() {
238+
DefaultSslBundleRegistry sslBundleRegistry = new DefaultSslBundleRegistry();
239+
JksSslStoreDetails keyStoreDetails = JksSslStoreDetails.forLocation("classpath:test.p12")
240+
.withPassword("secret");
241+
SslStoreBundle sslStoreBundle = new JksSslStoreBundle(keyStoreDetails, null);
242+
sslBundleRegistry.registerBundle("test-0", SslBundle.of(sslStoreBundle));
243+
return new SslInfo(sslBundleRegistry, Duration.ofDays(7));
244+
}
245+
246+
@Bean
247+
SslInfoContributor sslInfoContributor(SslInfo sslInfo) {
248+
return new SslInfoContributor(sslInfo);
249+
}
250+
189251
}
190252

191253
}

0 commit comments

Comments
 (0)