File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ pub struct ServerConfiguration {
7070#[ serde( deny_unknown_fields) ]
7171pub struct SubjectAlternativeNames {
7272 /// Ip addresses of the client.
73+ #[ serde( default ) ]
7374 #[ serde_as( as = "OneOrMany<_, PreferOne>" ) ]
7475 pub ip : Vec < IpAddr > ,
7576
@@ -306,6 +307,27 @@ mod tests {
306307
307308 #[ test]
308309 fn should_deserialize_client ( ) {
310+ let expected = ClientConfiguration {
311+ export_key : false ,
312+ subject_alternative_names : SubjectAlternativeNames {
313+ ip : vec ! [ ] ,
314+ dns_name : vec ! [ "my-client.org" . to_string( ) ] ,
315+ } ,
316+ include_certificate_chain : false ,
317+ } ;
318+ let json = json ! ( {
319+ "export_key" : false ,
320+ "dns_name" : "my-client.org" ,
321+ "include_certificate_chain" : false
322+ } ) ;
323+
324+ let deserialized: ClientConfiguration = serde_json:: from_value ( json) . unwrap ( ) ;
325+
326+ assert_eq ! ( deserialized, expected)
327+ }
328+
329+ #[ test]
330+ fn should_deserialize_client_with_ip ( ) {
309331 let expected = ClientConfiguration {
310332 export_key : false ,
311333 subject_alternative_names : SubjectAlternativeNames {
Original file line number Diff line number Diff line change 11# Creates a root ca
22my-root-ca :
3- # the my-root-ca key file is by default not exported
3+ # The my-root-ca key file is by default not exported
44 type : ca
55 certificates :
6- # my-intermediate-ca is issued by my-root-ca
6+ # The my-intermediate-ca is issued by my-root-ca
77 my-intermediate-ca :
88 type : ca
9- # We want to export the my-intermediate-ca key to be exported
9+ # We want the my-intermediate-ca key to be exported
1010 export_key : true
1111 certificates :
1212 # Create a client auth certificate issued by my-intermediate-ca
You can’t perform that action at this time.
0 commit comments