// [Test] // Integration Test
        public async Task Can_call_external_secure_service_using_remote_certificate()
        {
            try
            {
                // File.WriteAllBytes("grpc.crt", "https://todoworld.servicestack.net/grpc.crt".GetBytesFromUrl());
                // var cert = new X509Certificate2("grpc.crt");
                var cert = new X509Certificate2("https://todoworld.servicestack.net/grpc.crt".GetBytesFromUrl());

                var client = new GrpcServiceClient("https://todoworld.servicestack.net:50051",
                                                   cert, GrpcUtils.AllowSelfSignedCertificatesFrom("todoworld.servicestack.net"));

                var response = await client.GetAsync(new Hello { Name = "gRPC SSL C# 50051" });

                response.Result.Print();

                client = new GrpcServiceClient("https://todoworld.servicestack.net:5051",
                                               cert, GrpcUtils.AllowSelfSignedCertificatesFrom("todoworld.servicestack.net"));

                response = await client.GetAsync(new Hello { Name = "gRPC SSL C# 5051" });

                response.Result.Print();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Exemplo n.º 2
0
 public static GrpcServiceClient SecureProdClient(int port) => 
     new GrpcServiceClient($"https://todoworld.servicestack.net:{port}",
         new X509Certificate2("../../../../certs/prod.crt"),
         GrpcUtils.AllowSelfSignedCertificatesFrom("todoworld.servicestack.net"));
Exemplo n.º 3
0
 public static GrpcServiceClient CreateClient() => new GrpcServiceClient("https://localhost:5001",
                                                                         new X509Certificate2("../../../../certs/dev.crt"),
                                                                         GrpcUtils.AllowSelfSignedCertificatesFrom("localhost"));