Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/DeploymentService/AdminClientFactory.cs @ 3051

Last change on this file since 3051 was 3006, checked in by gkronber, 15 years ago

Implemented deployment service on servdev.heuristiclab.com and changed all service references and configurations to point to the service address. Improved GUI of installation manager. Implemented user name authentication and authorization for the deployment service. #860 (Deployment server for plugin installation from web locations)

File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.ServiceModel;
6using System.Security.Cryptography.X509Certificates;
7using System.Reflection;
8
9namespace HeuristicLab.PluginInfrastructure.Advanced.DeploymentService {
10  public static class AdminClientFactory {
11    private static byte[] serverCrtData;
12
13    static AdminClientFactory() {
14      var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.servdev.cer");
15      serverCrtData = new byte[stream.Length];
16      stream.Read(serverCrtData, 0, serverCrtData.Length);
17    }
18
19    public static AdminClient CreateClient() {
20      var client = new AdminClient();
21      client.ClientCredentials.UserName.UserName = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationUserName;
22      client.ClientCredentials.UserName.Password = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationPassword;
23      client.Endpoint.Address = new EndpointAddress(HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationAdministrationAddress);
24      client.ClientCredentials.ServiceCertificate.DefaultCertificate = new X509Certificate2(serverCrtData);
25      client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
26      return client;
27    }
28  }
29}
Note: See TracBrowser for help on using the repository browser.