Skip to content

Commit 0208e40

Browse files
Add SSL response structure to actuator info endpoint documentation
Signed-off-by: Shekhar Aggarwal <[email protected]>
1 parent 9784ae4 commit 0208e40

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,23 @@ 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[]
89+
90+
91+
92+
[[info.retrieving.response-structure.ssl]]
93+
==== SSL Response Structure
94+
95+
The following table describes the structure of the `ssl` section of the response:
96+
97+
[cols="2,1,3"]
98+
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: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
import org.springframework.boot.actuate.info.JavaInfoContributor;
3131
import org.springframework.boot.actuate.info.OsInfoContributor;
3232
import org.springframework.boot.actuate.info.ProcessInfoContributor;
33+
import org.springframework.boot.actuate.info.SslInfoContributor;
3334
import org.springframework.boot.info.BuildProperties;
3435
import org.springframework.boot.info.GitProperties;
36+
import org.springframework.boot.info.SslInfo;
3537
import org.springframework.context.annotation.Bean;
3638
import org.springframework.context.annotation.Configuration;
3739
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
@@ -55,7 +57,7 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
5557
void info() {
5658
assertThat(this.mvc.get().uri("/actuator/info")).hasStatusOk()
5759
.apply(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo(),
58-
javaInfo()));
60+
javaInfo(), sslInfo()));
5961
}
6062

6163
private ResponseFieldsSnippet gitInfo() {
@@ -142,6 +144,31 @@ private ResponseFieldsSnippet javaInfo() {
142144
.optional());
143145
}
144146

147+
private ResponseFieldsSnippet sslInfo() {
148+
return responseFields(beneathPath("ssl"),
149+
fieldWithPath("enabled").description("Whether SSL is enabled.").type(JsonFieldType.BOOLEAN),
150+
fieldWithPath("protocol").description("Protocol being used for SSL communication, if available.")
151+
.type(JsonFieldType.STRING)
152+
.optional(),
153+
fieldWithPath("ciphers").description("Ciphers used for SSL connections, if available.")
154+
.type(JsonFieldType.ARRAY)
155+
.optional(),
156+
fieldWithPath("trustStore").description("Trust store information.").optional(),
157+
fieldWithPath("trustStore.provider").description("Provider of the trust store, if available.")
158+
.type(JsonFieldType.STRING)
159+
.optional(),
160+
fieldWithPath("trustStore.type").description("Type of the trust store, if available.")
161+
.type(JsonFieldType.STRING)
162+
.optional(),
163+
fieldWithPath("keyStore").description("Key store information.").optional(),
164+
fieldWithPath("keyStore.provider").description("Provider of the key store, if available.")
165+
.type(JsonFieldType.STRING)
166+
.optional(),
167+
fieldWithPath("keyStore.type").description("Type of the key store, if available.")
168+
.type(JsonFieldType.STRING)
169+
.optional());
170+
}
171+
145172
@Configuration(proxyBeanMethods = false)
146173
static class TestConfiguration {
147174

@@ -186,6 +213,17 @@ JavaInfoContributor javaInfoContributor() {
186213
return new JavaInfoContributor();
187214
}
188215

216+
@Bean
217+
SslInfo sslInfo() {
218+
// Create a mock SslInfo that will provide the SSL information
219+
return new SslInfo(null, null);
220+
}
221+
222+
@Bean
223+
SslInfoContributor sslInfoContributor(SslInfo sslInfo) {
224+
return new SslInfoContributor(sslInfo);
225+
}
226+
189227
}
190228

191229
}

0 commit comments

Comments
 (0)