30
30
import org .springframework .boot .actuate .info .JavaInfoContributor ;
31
31
import org .springframework .boot .actuate .info .OsInfoContributor ;
32
32
import org .springframework .boot .actuate .info .ProcessInfoContributor ;
33
+ import org .springframework .boot .actuate .info .SslInfoContributor ;
33
34
import org .springframework .boot .info .BuildProperties ;
34
35
import org .springframework .boot .info .GitProperties ;
36
+ import org .springframework .boot .info .SslInfo ;
35
37
import org .springframework .context .annotation .Bean ;
36
38
import org .springframework .context .annotation .Configuration ;
37
39
import org .springframework .restdocs .mockmvc .MockMvcRestDocumentation ;
@@ -54,8 +56,8 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
54
56
@ Test
55
57
void info () {
56
58
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 ()));
59
61
}
60
62
61
63
private ResponseFieldsSnippet gitInfo () {
@@ -71,12 +73,12 @@ private ResponseFieldsSnippet buildInfo() {
71
73
fieldWithPath ("artifact" ).description ("Artifact ID of the application, if any." ).optional (),
72
74
fieldWithPath ("group" ).description ("Group ID of the application, if any." ).optional (),
73
75
fieldWithPath ("name" ).description ("Name of the application, if any." )
74
- .type (JsonFieldType .STRING )
75
- .optional (),
76
+ .type (JsonFieldType .STRING )
77
+ .optional (),
76
78
fieldWithPath ("version" ).description ("Version of the application, if any." ).optional (),
77
79
fieldWithPath ("time" ).description ("Timestamp of when the application was built, if any." )
78
- .type (JsonFieldType .VARIES )
79
- .optional ());
80
+ .type (JsonFieldType .VARIES )
81
+ .optional ());
80
82
}
81
83
82
84
private ResponseFieldsSnippet osInfo () {
@@ -87,8 +89,8 @@ private ResponseFieldsSnippet osInfo() {
87
89
88
90
private FieldDescriptor osInfoField (String field , String desc ) {
89
91
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 ();
92
94
}
93
95
94
96
private ResponseFieldsSnippet processInfo () {
@@ -97,49 +99,68 @@ private ResponseFieldsSnippet processInfo() {
97
99
fieldWithPath ("parentPid" ).description ("Parent Process ID (or -1)." ).type (JsonFieldType .NUMBER ),
98
100
fieldWithPath ("owner" ).description ("Process owner." ).type (JsonFieldType .STRING ),
99
101
fieldWithPath ("cpus" ).description ("Number of CPUs available to the process." )
100
- .type (JsonFieldType .NUMBER ),
102
+ .type (JsonFieldType .NUMBER ),
101
103
fieldWithPath ("memory" ).description ("Memory information." ),
102
104
fieldWithPath ("memory.heap" ).description ("Heap memory." ),
103
105
fieldWithPath ("memory.heap.init" ).description ("Number of bytes initially requested by the JVM." ),
104
106
fieldWithPath ("memory.heap.used" ).description ("Number of bytes currently being used." ),
105
107
fieldWithPath ("memory.heap.committed" ).description ("Number of bytes committed for JVM use." ),
106
108
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)." ),
108
110
fieldWithPath ("memory.nonHeap" ).description ("Non-heap memory." ),
109
111
fieldWithPath ("memory.nonHeap.init" ).description ("Number of bytes initially requested by the JVM." ),
110
112
fieldWithPath ("memory.nonHeap.used" ).description ("Number of bytes currently being used." ),
111
113
fieldWithPath ("memory.nonHeap.committed" ).description ("Number of bytes committed for JVM use." ),
112
114
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)." ));
114
116
}
115
117
116
118
private ResponseFieldsSnippet javaInfo () {
117
119
return responseFields (beneathPath ("java" ),
118
120
fieldWithPath ("version" ).description ("Java version, if available." )
119
- .type (JsonFieldType .STRING )
120
- .optional (),
121
+ .type (JsonFieldType .STRING )
122
+ .optional (),
121
123
fieldWithPath ("vendor" ).description ("Vendor details." ),
122
124
fieldWithPath ("vendor.name" ).description ("Vendor name, if available." )
123
- .type (JsonFieldType .STRING )
124
- .optional (),
125
+ .type (JsonFieldType .STRING )
126
+ .optional (),
125
127
fieldWithPath ("vendor.version" ).description ("Vendor version, if available." )
126
- .type (JsonFieldType .STRING )
127
- .optional (),
128
+ .type (JsonFieldType .STRING )
129
+ .optional (),
128
130
fieldWithPath ("runtime" ).description ("Runtime details." ),
129
131
fieldWithPath ("runtime.name" ).description ("Runtime name, if available." )
130
- .type (JsonFieldType .STRING )
131
- .optional (),
132
+ .type (JsonFieldType .STRING )
133
+ .optional (),
132
134
fieldWithPath ("runtime.version" ).description ("Runtime version, if available." )
133
- .type (JsonFieldType .STRING )
134
- .optional (),
135
+ .type (JsonFieldType .STRING )
136
+ .optional (),
135
137
fieldWithPath ("jvm" ).description ("JVM details." ),
136
138
fieldWithPath ("jvm.name" ).description ("JVM name, if available." ).type (JsonFieldType .STRING ).optional (),
137
139
fieldWithPath ("jvm.vendor" ).description ("JVM vendor, if available." )
138
- .type (JsonFieldType .STRING )
139
- .optional (),
140
+ .type (JsonFieldType .STRING )
141
+ .optional (),
140
142
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 ());
143
164
}
144
165
145
166
@ Configuration (proxyBeanMethods = false )
@@ -186,6 +207,17 @@ JavaInfoContributor javaInfoContributor() {
186
207
return new JavaInfoContributor ();
187
208
}
188
209
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
+
189
221
}
190
222
191
223
}
0 commit comments