Skip to content

Commit

Permalink
set certificate information
Browse files Browse the repository at this point in the history
  • Loading branch information
solankisamir committed Aug 8, 2018
1 parent 447a0f6 commit 502fd98
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static HostnameConfiguration GetHostnameConfiguration(
var hostnameConfiguration = new HostnameConfiguration(
Mappers.MapHostnameType(hostnameConfig.HostnameType),
hostnameConfig.Hostname);

if (!string.IsNullOrWhiteSpace(hostnameConfig.EncodedCertificate))
{
hostnameConfiguration.EncodedCertificate = hostnameConfig.EncodedCertificate;
Expand All @@ -55,6 +56,11 @@ public static HostnameConfiguration GetHostnameConfiguration(
hostnameConfiguration.NegotiateClientCertificate = hostnameConfig.NegotiateClientCertificate.Value;
}

if (hostnameConfig.CertificateInformation != null && hostnameConfig.EncodedCertificate == null)
{
hostnameConfiguration.Certificate = hostnameConfig.CertificateInformation.ToCertificateInformation();
}

return hostnameConfiguration;
}

Expand All @@ -78,5 +84,20 @@ public static CertificateConfiguration GetCertificateConfiguration(this PsApiMan

return certificateConfiguration;
}

public static CertificateInformation ToCertificateInformation(this PsApiManagementCertificateInformation psCertificate)
{
if (psCertificate == null)
{
return null;
}

var certificateInformation = new CertificateInformation();
certificateInformation.Thumbprint = psCertificate.Thumbprint;
certificateInformation.Expiry = psCertificate.Expiry;
certificateInformation.Subject = psCertificate.Subject;

return certificateInformation;
}
}
}

0 comments on commit 502fd98

Please sign in to comment.