Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RestClientService"/> class
 /// with a specified <see cref="IRestClientDescription"/> instance.
 /// </summary>
 /// <param name="configuration">The configuration instance.</param>
 public RestClientService(IRestClientDescription configuration) : base(configuration)
 {
     if (this.Description == null)
     {
         this.Description = InternalConfiguration.GetServiceClientConfiguration().Clients.Find(d => d.Name == endpointName);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RestClient"/> class.
 /// </summary>
 /// <param name="config">The configuration.</param>
 /// <exception cref="System.Security.SecurityException"></exception>
 public RestClient(IRestClientDescription config) : base(config)
 {
     // Find the specified certificate
     if (config.Binding?.Security?.ClientCertificate != null)
     {
         this.ClientCertificates = new X509Certificate2Collection();
         var cert = SecurityUtils.FindCertificate(config.Binding.Security.ClientCertificate.FindType,
                                                  config.Binding.Security.ClientCertificate.StoreLocation,
                                                  config.Binding.Security.ClientCertificate.StoreName,
                                                  config.Binding.Security.ClientCertificate.FindValue);
         if (cert == null)
         {
             throw new SecurityException(String.Format("Certificate described by {0} could not be found in {1}/{2}",
                                                       config.Binding.Security.ClientCertificate.FindValue,
                                                       config.Binding.Security.ClientCertificate.StoreLocation,
                                                       config.Binding.Security.ClientCertificate.StoreName));
         }
         this.ClientCertificates.Add(cert);
     }
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OpenIZ.Core.Http.RestClient"/> class.
 /// </summary>
 /// <param name="binder">The serialization binder to use.</param>
 public RestClientBase(IRestClientDescription config)
 {
     this.m_configuration = config;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OpenIZ.Mobile.Core.Interop.Clients.ServiceClientBase"/> class.
 /// </summary>
 /// <param name="clientName">Client name.</param>
 public ServiceClientBase(IRestClient restClient)
 {
     this.m_restClient    = restClient;
     this.m_configuration = this.m_restClient.Description;
 }