public void AddWithDefaultOptions() { var ipPort = GetEndpointWithFreeRandomPort(); var appId = Guid.NewGuid(); var configuration = new CertificateBindingConfiguration(); var updated = configuration.Bind(new CertificateBinding(_testingCertThumbprint, StoreName.My, ipPort, appId)); Assert.IsFalse(updated); var result = CertConfigCmd.Show(ipPort); Assert.IsTrue(result.IsSuccessfull); var expectedOutput = string.Format( @" IP:port : {0} Certificate Hash : {1} Application ID : {2} Certificate Store Name : My Verify Client Certificate Revocation : Enabled Verify Revocation Using Cached Client Certificate Only : Disabled Usage Check : Enabled Revocation Freshness Time : 0 URL Retrieval Timeout : 0 Ctl Identifier : (null) Ctl Store Name : (null) DS Mapper Usage : Disabled Negotiate Client Certificate : Disabled " , ipPort, _testingCertThumbprint, appId.ToString("B")); Assert.IsTrue(result.Output.ToLowerInvariant().Contains(expectedOutput.ToLowerInvariant())); }
public void Update() { var ipPort = GetEndpointWithFreeRandomPort(); var appId = Guid.NewGuid(); CertConfigCmd.Add(new CertConfigCmd.Options { ipport = ipPort, certhash = _testingCertThumbprint, appid = appId, certstorename = StoreName.AuthRoot.ToString(), }); var configuration = new CertificateBindingConfiguration(); var binding = new CertificateBinding(_testingCertThumbprint, StoreName.My, ipPort, appId, new BindingOptions { DoNotPassRequestsToRawFilters = true, DoNotVerifyCertificateRevocation = true, EnableRevocationFreshnessTime = true, NegotiateCertificate = true, NoUsageCheck = true, RevocationFreshnessTime = TimeSpan.FromMinutes(1), RevocationUrlRetrievalTimeout = TimeSpan.FromSeconds(5), UseDsMappers = true, VerifyRevocationWithCachedCertificateOnly = true, }); var updated = configuration.Bind(binding); Assert.IsTrue(updated); var result = CertConfigCmd.Show(ipPort); Assert.IsTrue(result.IsSuccessfull); var expectedOutput = string.Format( @" IP:port : {0} Certificate Hash : {1} Application ID : {2} Certificate Store Name : My Verify Client Certificate Revocation : Disabled Verify Revocation Using Cached Client Certificate Only : Enabled Usage Check : Disabled Revocation Freshness Time : 60 URL Retrieval Timeout : 5000 Ctl Identifier : (null) Ctl Store Name : (null) DS Mapper Usage : Enabled Negotiate Client Certificate : Enabled " , ipPort, _testingCertThumbprint, appId.ToString("B")); Assert.IsTrue(result.Output.ToLowerInvariant().Contains(expectedOutput.ToLowerInvariant())); }