File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/ResourceManager/ApiManagement/Commands.ApiManagement/Helpers Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,13 @@ public static HostnameConfiguration GetHostnameConfiguration(
55
55
hostnameConfiguration . NegotiateClientCertificate = hostnameConfig . NegotiateClientCertificate . Value ;
56
56
}
57
57
58
+ // if no new certificate is provided, then copy over details of existing certificate
59
+ if ( hostnameConfig . CertificateInformation != null &&
60
+ string . IsNullOrEmpty ( hostnameConfig . EncodedCertificate ) )
61
+ {
62
+ hostnameConfiguration . Certificate = hostnameConfig . CertificateInformation . GetCertificateInformation ( ) ;
63
+ }
64
+
58
65
return hostnameConfiguration ;
59
66
}
60
67
@@ -76,7 +83,28 @@ public static CertificateConfiguration GetCertificateConfiguration(this PsApiMan
76
83
certificateConfiguration . CertificatePassword = systemCertificate . CertificatePassword ;
77
84
}
78
85
86
+ if ( systemCertificate . CertificateInformation != null &&
87
+ string . IsNullOrEmpty ( systemCertificate . EncodedCertificate ) )
88
+ {
89
+ certificateConfiguration . Certificate = systemCertificate . CertificateInformation . GetCertificateInformation ( ) ;
90
+ }
91
+
79
92
return certificateConfiguration ;
80
93
}
94
+
95
+ public static CertificateInformation GetCertificateInformation ( this PsApiManagementCertificateInformation psCertificateInformation )
96
+ {
97
+ if ( psCertificateInformation == null )
98
+ {
99
+ return null ;
100
+ }
101
+
102
+ var certificateInformation = new CertificateInformation ( ) ;
103
+ certificateInformation . Expiry = psCertificateInformation . Expiry ;
104
+ certificateInformation . Thumbprint = psCertificateInformation . Thumbprint ;
105
+ certificateInformation . Subject = psCertificateInformation . Subject ;
106
+
107
+ return certificateInformation ;
108
+ }
81
109
}
82
110
}
You can’t perform that action at this time.
0 commit comments