public static HostnameConfiguration GetHostnameConfiguration( this PsApiManagementCustomHostNameConfiguration hostnameConfig) { if (hostnameConfig == null) { return(null); } var hostnameConfiguration = new HostnameConfiguration( Mappers.MapHostnameType(hostnameConfig.HostnameType), hostnameConfig.Hostname); if (!string.IsNullOrWhiteSpace(hostnameConfig.EncodedCertificate)) { hostnameConfiguration.EncodedCertificate = hostnameConfig.EncodedCertificate; } if (hostnameConfig.CertificatePassword != null) { hostnameConfiguration.CertificatePassword = hostnameConfig.CertificatePassword; } if (!string.IsNullOrWhiteSpace(hostnameConfig.KeyVaultId)) { hostnameConfiguration.KeyVaultId = hostnameConfig.KeyVaultId; } if (!string.IsNullOrWhiteSpace(hostnameConfig.IdentityClientId)) { hostnameConfiguration.IdentityClientId = hostnameConfig.IdentityClientId; } if (hostnameConfig.DefaultSslBinding.HasValue) { hostnameConfiguration.DefaultSslBinding = hostnameConfig.DefaultSslBinding.Value; } if (hostnameConfig.NegotiateClientCertificate.HasValue) { hostnameConfiguration.NegotiateClientCertificate = hostnameConfig.NegotiateClientCertificate.Value; } // if no new certificate is provided, then copy over details of existing certificate if (hostnameConfig.CertificateInformation != null && string.IsNullOrEmpty(hostnameConfig.EncodedCertificate)) { hostnameConfiguration.Certificate = hostnameConfig.CertificateInformation.GetCertificateInformation(); } return(hostnameConfiguration); }
public static HostnameConfiguration GetHostnameConfiguration( this PsApiManagementCustomHostNameConfiguration hostnameConfig) { if (hostnameConfig == null) { return(null); } var hostnameConfiguration = new HostnameConfiguration( Mappers.MapHostnameType(hostnameConfig.HostnameType), hostnameConfig.Hostname); if (!string.IsNullOrWhiteSpace(hostnameConfig.EncodedCertificate)) { hostnameConfiguration.EncodedCertificate = hostnameConfig.EncodedCertificate; } if (hostnameConfig.CertificatePassword != null) { hostnameConfiguration.CertificatePassword = hostnameConfig.CertificatePassword; } if (!string.IsNullOrWhiteSpace(hostnameConfig.KeyVaultId)) { hostnameConfiguration.KeyVaultId = hostnameConfig.KeyVaultId; } if (hostnameConfig.DefaultSslBinding.HasValue) { hostnameConfiguration.DefaultSslBinding = hostnameConfig.DefaultSslBinding.Value; } if (hostnameConfig.NegotiateClientCertificate.HasValue) { hostnameConfiguration.NegotiateClientCertificate = hostnameConfig.NegotiateClientCertificate.Value; } return(hostnameConfiguration); }