예제 #1
0
        private static void Delete(string[] args, CertificateBindingConfiguration configuration)
        {
            var endPoint = ParseIpEndPoint(args[1]);

            configuration.Delete(endPoint);
            Console.WriteLine("The binding record has been successfully removed.");
        }
예제 #2
0
        public void DeleteMany()
        {
            var ipPort1 = GetEndpointWithFreeRandomPort();

            Thread.Sleep(500);

            var appId1 = Guid.NewGuid();

            CertConfigCmd.Add(new CertConfigCmd.Options {
                ipport   = ipPort1,
                certhash = _testingCertThumbprint,
                appid    = appId1,
            });

            var ipPort2 = GetEndpointWithFreeRandomPort();
            var appId2  = Guid.NewGuid();

            CertConfigCmd.Add(new CertConfigCmd.Options {
                ipport   = ipPort2,
                certhash = _testingCertThumbprint,
                appid    = appId2,
            });

            var config = new CertificateBindingConfiguration();

            config.Delete(new[] { ipPort1, ipPort2 });
            Assert.IsFalse(CertConfigCmd.IpPortIsPresentInConfig(ipPort1));
            Assert.IsFalse(CertConfigCmd.IpPortIsPresentInConfig(ipPort2));
        }
예제 #3
0
        /// <summary>
        /// 删除指定端口的HTTPS绑定
        /// </summary>
        /// <param name="httpsPort"></param>
        public static void RemoveBind(int httpsPort)
        {
            UserHelper.CheckIsAdministrator();

            var        configuration = new CertificateBindingConfiguration();
            IPEndPoint sslPort       = new IPEndPoint(IPAddress.Any, httpsPort);

            configuration.Delete(sslPort);
        }
        public void UpdateCertificateBinding(string thumbprint, int httpsPort, List <Action> rollbackActions)
        {
            CertificateBindingConfiguration bindingConfiguration = new CertificateBindingConfiguration();
            CertificateBinding originalBinding = this.GetCertificateBinding(bindingConfiguration);

            if (originalBinding != null)
            {
                bindingConfiguration.Delete(originalBinding.IpPort);
                rollbackActions.Add(() => bindingConfiguration.Bind(originalBinding));
            }

            CertificateBinding binding = new CertificateBinding(thumbprint, "My", new IPEndPoint(IPAddress.Parse("0.0.0.0"), httpsPort), HttpSysHostingOptions.AppId, new BindingOptions());

            bindingConfiguration.Bind(binding);
            rollbackActions.Add(() => bindingConfiguration.Delete(binding.IpPort));

            this.registryProvider.CertBinding = binding.IpPort.ToString();
            rollbackActions.Add(() => this.registryProvider.CertBinding = originalBinding?.IpPort?.ToString());
        }
예제 #5
0
        public void DeleteOne()
        {
            var ipPort = GetEndpointWithFreeRandomPort();
            var appId  = Guid.NewGuid();

            CertConfigCmd.Add(new CertConfigCmd.Options {
                ipport        = ipPort,
                certhash      = _testingCertThumbprint,
                appid         = appId,
                certstorename = null,
            });

            var config = new CertificateBindingConfiguration();

            config.Delete(ipPort);
            Assert.IsFalse(CertConfigCmd.IpPortIsPresentInConfig(ipPort));
        }
예제 #6
0
		public void DeleteMany() {
			var ipPort1 = GetEndpointWithFreeRandomPort();
			Thread.Sleep(500);

			var appId1 = Guid.NewGuid();
			CertConfigCmd.Add(new CertConfigCmd.Options {
				ipport = ipPort1,
				certhash = _testingCertThumbprint,
				appid = appId1,
			});

			var ipPort2 = GetEndpointWithFreeRandomPort();
			var appId2 = Guid.NewGuid();
			CertConfigCmd.Add(new CertConfigCmd.Options {
				ipport = ipPort2,
				certhash = _testingCertThumbprint,
				appid = appId2,
			});

			var config = new CertificateBindingConfiguration();
			config.Delete(new[] { ipPort1, ipPort2 });
			Assert.IsFalse(CertConfigCmd.IpPortIsPresentInConfig(ipPort1));
			Assert.IsFalse(CertConfigCmd.IpPortIsPresentInConfig(ipPort2));
		}
예제 #7
0
		public void DeleteOne() {
			var ipPort = GetEndpointWithFreeRandomPort();
			var appId = Guid.NewGuid();

			CertConfigCmd.Add(new CertConfigCmd.Options {
				ipport = ipPort,
				certhash = _testingCertThumbprint,
				appid = appId,
				certstorename = null,
			});

			var config = new CertificateBindingConfiguration();
			config.Delete(ipPort);
			Assert.IsFalse(CertConfigCmd.IpPortIsPresentInConfig(ipPort));
		}
예제 #8
0
		private static void Delete(string[] args, CertificateBindingConfiguration configuration){
			var endPoint = ParseIpEndPoint(args[1]);
			configuration.Delete(endPoint);
			Console.WriteLine("The binding record has been successfully removed.");
		}