1616
1717package org .springframework .boot .actuate .autoconfigure .info ;
1818
19+ import java .time .Duration ;
1920import java .time .Instant ;
2021import java .util .List ;
2122import java .util .Properties ;
3031import org .springframework .boot .actuate .info .JavaInfoContributor ;
3132import org .springframework .boot .actuate .info .OsInfoContributor ;
3233import org .springframework .boot .actuate .info .ProcessInfoContributor ;
34+ import org .springframework .boot .actuate .info .SslInfoContributor ;
3335import org .springframework .boot .info .BuildProperties ;
3436import 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 ;
3543import org .springframework .context .annotation .Bean ;
3644import org .springframework .context .annotation .Configuration ;
3745import 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 () {
@@ -166,6 +174,45 @@ private ResponseFieldsSnippet javaInfo() {
166174 .optional ());
167175 }
168176
177+ private ResponseFieldsSnippet sslInfo () {
178+ return responseFields (beneathPath ("ssl" ),
179+ fieldWithPath ("bundles" ).description ("SSL bundles information." ).type (JsonFieldType .ARRAY ),
180+ fieldWithPath ("bundles[].name" ).description ("Name of the SSL bundle." ).type (JsonFieldType .STRING ),
181+ fieldWithPath ("bundles[].certificateChains" ).description ("Certificate chains in the bundle." )
182+ .type (JsonFieldType .ARRAY ),
183+ fieldWithPath ("bundles[].certificateChains[].alias" ).description ("Alias of the certificate chain." )
184+ .type (JsonFieldType .STRING ),
185+ fieldWithPath ("bundles[].certificateChains[].certificates" ).description ("Certificates in the chain." )
186+ .type (JsonFieldType .ARRAY ),
187+ fieldWithPath ("bundles[].certificateChains[].certificates[].subject" )
188+ .description ("Subject of the certificate." )
189+ .type (JsonFieldType .STRING ),
190+ fieldWithPath ("bundles[].certificateChains[].certificates[].version" )
191+ .description ("Version of the certificate." )
192+ .type (JsonFieldType .STRING ),
193+ fieldWithPath ("bundles[].certificateChains[].certificates[].issuer" )
194+ .description ("Issuer of the certificate." )
195+ .type (JsonFieldType .STRING ),
196+ fieldWithPath ("bundles[].certificateChains[].certificates[].validityStarts" )
197+ .description ("Certificate validity start date." )
198+ .type (JsonFieldType .STRING ),
199+ fieldWithPath ("bundles[].certificateChains[].certificates[].serialNumber" )
200+ .description ("Serial number of the certificate." )
201+ .type (JsonFieldType .STRING ),
202+ fieldWithPath ("bundles[].certificateChains[].certificates[].validityEnds" )
203+ .description ("Certificate validity end date." )
204+ .type (JsonFieldType .STRING ),
205+ fieldWithPath ("bundles[].certificateChains[].certificates[].validity" )
206+ .description ("Certificate validity information." )
207+ .type (JsonFieldType .OBJECT ),
208+ fieldWithPath ("bundles[].certificateChains[].certificates[].validity.status" )
209+ .description ("Certificate validity status." )
210+ .type (JsonFieldType .STRING ),
211+ fieldWithPath ("bundles[].certificateChains[].certificates[].signatureAlgorithmName" )
212+ .description ("Signature algorithm name." )
213+ .type (JsonFieldType .STRING ));
214+ }
215+
169216 @ Configuration (proxyBeanMethods = false )
170217 static class TestConfiguration {
171218
@@ -210,6 +257,21 @@ JavaInfoContributor javaInfoContributor() {
210257 return new JavaInfoContributor ();
211258 }
212259
260+ @ Bean
261+ SslInfo sslInfo () {
262+ DefaultSslBundleRegistry sslBundleRegistry = new DefaultSslBundleRegistry ();
263+ JksSslStoreDetails keyStoreDetails = JksSslStoreDetails .forLocation ("classpath:test.p12" )
264+ .withPassword ("secret" );
265+ SslStoreBundle sslStoreBundle = new JksSslStoreBundle (keyStoreDetails , null );
266+ sslBundleRegistry .registerBundle ("test-0" , SslBundle .of (sslStoreBundle ));
267+ return new SslInfo (sslBundleRegistry , Duration .ofDays (7 ));
268+ }
269+
270+ @ Bean
271+ SslInfoContributor sslInfoContributor (SslInfo sslInfo ) {
272+ return new SslInfoContributor (sslInfo );
273+ }
274+
213275 }
214276
215277}
0 commit comments