3030import org .springframework .boot .actuate .info .JavaInfoContributor ;
3131import org .springframework .boot .actuate .info .OsInfoContributor ;
3232import org .springframework .boot .actuate .info .ProcessInfoContributor ;
33+ import org .springframework .boot .actuate .info .SslInfoContributor ;
3334import org .springframework .boot .info .BuildProperties ;
3435import org .springframework .boot .info .GitProperties ;
36+ import org .springframework .boot .info .SslInfo ;
3537import org .springframework .context .annotation .Bean ;
3638import org .springframework .context .annotation .Configuration ;
3739import org .springframework .restdocs .mockmvc .MockMvcRestDocumentation ;
@@ -54,8 +56,8 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
5456 @ Test
5557 void info () {
5658 assertThat (this .mvc .get ().uri ("/actuator/info" )).hasStatusOk ()
57- .apply (MockMvcRestDocumentation .document ("info" , gitInfo (), buildInfo (), osInfo (), processInfo (),
58- javaInfo ()));
59+ .apply (MockMvcRestDocumentation .document ("info" , gitInfo (), buildInfo (), osInfo (), processInfo (),
60+ javaInfo (), sslInfo ()));
5961 }
6062
6163 private ResponseFieldsSnippet gitInfo () {
@@ -71,12 +73,12 @@ private ResponseFieldsSnippet buildInfo() {
7173 fieldWithPath ("artifact" ).description ("Artifact ID of the application, if any." ).optional (),
7274 fieldWithPath ("group" ).description ("Group ID of the application, if any." ).optional (),
7375 fieldWithPath ("name" ).description ("Name of the application, if any." )
74- .type (JsonFieldType .STRING )
75- .optional (),
76+ .type (JsonFieldType .STRING )
77+ .optional (),
7678 fieldWithPath ("version" ).description ("Version of the application, if any." ).optional (),
7779 fieldWithPath ("time" ).description ("Timestamp of when the application was built, if any." )
78- .type (JsonFieldType .VARIES )
79- .optional ());
80+ .type (JsonFieldType .VARIES )
81+ .optional ());
8082 }
8183
8284 private ResponseFieldsSnippet osInfo () {
@@ -87,8 +89,8 @@ private ResponseFieldsSnippet osInfo() {
8789
8890 private FieldDescriptor osInfoField (String field , String desc ) {
8991 return fieldWithPath (field ).description (desc + " (as obtained from the 'os." + field + "' system property)." )
90- .type (JsonFieldType .STRING )
91- .optional ();
92+ .type (JsonFieldType .STRING )
93+ .optional ();
9294 }
9395
9496 private ResponseFieldsSnippet processInfo () {
@@ -97,49 +99,68 @@ private ResponseFieldsSnippet processInfo() {
9799 fieldWithPath ("parentPid" ).description ("Parent Process ID (or -1)." ).type (JsonFieldType .NUMBER ),
98100 fieldWithPath ("owner" ).description ("Process owner." ).type (JsonFieldType .STRING ),
99101 fieldWithPath ("cpus" ).description ("Number of CPUs available to the process." )
100- .type (JsonFieldType .NUMBER ),
102+ .type (JsonFieldType .NUMBER ),
101103 fieldWithPath ("memory" ).description ("Memory information." ),
102104 fieldWithPath ("memory.heap" ).description ("Heap memory." ),
103105 fieldWithPath ("memory.heap.init" ).description ("Number of bytes initially requested by the JVM." ),
104106 fieldWithPath ("memory.heap.used" ).description ("Number of bytes currently being used." ),
105107 fieldWithPath ("memory.heap.committed" ).description ("Number of bytes committed for JVM use." ),
106108 fieldWithPath ("memory.heap.max" )
107- .description ("Maximum number of bytes that can be used by the JVM (or -1)." ),
109+ .description ("Maximum number of bytes that can be used by the JVM (or -1)." ),
108110 fieldWithPath ("memory.nonHeap" ).description ("Non-heap memory." ),
109111 fieldWithPath ("memory.nonHeap.init" ).description ("Number of bytes initially requested by the JVM." ),
110112 fieldWithPath ("memory.nonHeap.used" ).description ("Number of bytes currently being used." ),
111113 fieldWithPath ("memory.nonHeap.committed" ).description ("Number of bytes committed for JVM use." ),
112114 fieldWithPath ("memory.nonHeap.max" )
113- .description ("Maximum number of bytes that can be used by the JVM (or -1)." ));
115+ .description ("Maximum number of bytes that can be used by the JVM (or -1)." ));
114116 }
115117
116118 private ResponseFieldsSnippet javaInfo () {
117119 return responseFields (beneathPath ("java" ),
118120 fieldWithPath ("version" ).description ("Java version, if available." )
119- .type (JsonFieldType .STRING )
120- .optional (),
121+ .type (JsonFieldType .STRING )
122+ .optional (),
121123 fieldWithPath ("vendor" ).description ("Vendor details." ),
122124 fieldWithPath ("vendor.name" ).description ("Vendor name, if available." )
123- .type (JsonFieldType .STRING )
124- .optional (),
125+ .type (JsonFieldType .STRING )
126+ .optional (),
125127 fieldWithPath ("vendor.version" ).description ("Vendor version, if available." )
126- .type (JsonFieldType .STRING )
127- .optional (),
128+ .type (JsonFieldType .STRING )
129+ .optional (),
128130 fieldWithPath ("runtime" ).description ("Runtime details." ),
129131 fieldWithPath ("runtime.name" ).description ("Runtime name, if available." )
130- .type (JsonFieldType .STRING )
131- .optional (),
132+ .type (JsonFieldType .STRING )
133+ .optional (),
132134 fieldWithPath ("runtime.version" ).description ("Runtime version, if available." )
133- .type (JsonFieldType .STRING )
134- .optional (),
135+ .type (JsonFieldType .STRING )
136+ .optional (),
135137 fieldWithPath ("jvm" ).description ("JVM details." ),
136138 fieldWithPath ("jvm.name" ).description ("JVM name, if available." ).type (JsonFieldType .STRING ).optional (),
137139 fieldWithPath ("jvm.vendor" ).description ("JVM vendor, if available." )
138- .type (JsonFieldType .STRING )
139- .optional (),
140+ .type (JsonFieldType .STRING )
141+ .optional (),
140142 fieldWithPath ("jvm.version" ).description ("JVM version, if available." )
141- .type (JsonFieldType .STRING )
142- .optional ());
143+ .type (JsonFieldType .STRING )
144+ .optional ());
145+ }
146+
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 ).optional (),
152+ fieldWithPath ("ciphers" ).description ("Ciphers used for SSL connections, if available." )
153+ .type (JsonFieldType .ARRAY ).optional (),
154+ fieldWithPath ("trustStore" ).description ("Trust store information." ).optional (),
155+ fieldWithPath ("trustStore.provider" ).description ("Provider of the trust store, if available." )
156+ .type (JsonFieldType .STRING ).optional (),
157+ fieldWithPath ("trustStore.type" ).description ("Type of the trust store, if available." )
158+ .type (JsonFieldType .STRING ).optional (),
159+ fieldWithPath ("keyStore" ).description ("Key store information." ).optional (),
160+ fieldWithPath ("keyStore.provider" ).description ("Provider of the key store, if available." )
161+ .type (JsonFieldType .STRING ).optional (),
162+ fieldWithPath ("keyStore.type" ).description ("Type of the key store, if available." )
163+ .type (JsonFieldType .STRING ).optional ());
143164 }
144165
145166 @ Configuration (proxyBeanMethods = false )
@@ -186,6 +207,17 @@ JavaInfoContributor javaInfoContributor() {
186207 return new JavaInfoContributor ();
187208 }
188209
210+ @ Bean
211+ SslInfo sslInfo () {
212+ // Create a mock SslInfo that will provide the SSL information
213+ return new SslInfo (null , null );
214+ }
215+
216+ @ Bean
217+ SslInfoContributor sslInfoContributor (SslInfo sslInfo ) {
218+ return new SslInfoContributor (sslInfo );
219+ }
220+
189221 }
190222
191223}
0 commit comments