using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; namespace HeuristicLab.Services.Authentication { public class ClientFactory { public static T Create() where T : ClientBase, I where I : class { var client = Activator.CreateInstance(); client.ClientCredentials.UserName.UserName = "Alice"; client.ClientCredentials.UserName.Password = "YouWillKnow"; client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None; return client; } } }