]> khamidou — GitHub mirrors - electron.git/commitdiff
default to first certificate from cert store
authordeepak1556 <hop2deep@gmail.com>
Mon, 8 Jun 2015 16:05:32 +0000 (21:35 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Tue, 9 Jun 2015 07:30:20 +0000 (13:00 +0530)
atom/browser/atom_browser_client.cc

index 2d5db4d17d13bbfd7067705e72e016aaba36b31d..d0f2df2122cdb37ab37fa4279978cc7a1fdaa7dd 100644 (file)
@@ -217,12 +217,19 @@ void AtomBrowserClient::SelectClientCertificate(
   auto cert_path = command_line->GetSwitchValueNative(
       switches::kClientCertificate);
 
-  if (cert_path.empty())
-    return;
+  // TODO(zcbenz): allow users to select certificate from
+  // client_cert list. Right now defaults to first certificate
+  // in the list.
+  scoped_refptr<net::X509Certificate> certificate;
+  if (cert_path.empty()) {
+    if (!cert_request_info->client_certs.empty())
+      certificate = cert_request_info->client_certs[0];
+  } else {
+    certificate = ImportCertFromFile(base::FilePath(cert_path));
+  }
 
-  scoped_refptr<net::X509Certificate> certificate =
-      ImportCertFromFile(base::FilePath(cert_path));
-  delegate->ContinueWithCertificate(certificate.get());
+  if (certificate.get())
+    delegate->ContinueWithCertificate(certificate.get());
 }
 
 brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(