From 10877c3ec0184e6c2a07b8775d32c8efc38a29a3 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 21 Jun 2018 12:16:00 +0200 Subject: Enable client certificate store Creates the default client cerficate store for the platform and when given a choice of client certificates forwards to the choice to the application. Only a Widgets API for now. Task-number: QTBUG-54877 Change-Id: Ie15152398d5769579fa0c07e3e3035c2374e9940 Reviewed-by: Michal Klocek --- examples/webenginewidgets/simplebrowser/webpage.cpp | 8 ++++++++ examples/webenginewidgets/simplebrowser/webpage.h | 1 + 2 files changed, 9 insertions(+) (limited to 'examples') diff --git a/examples/webenginewidgets/simplebrowser/webpage.cpp b/examples/webenginewidgets/simplebrowser/webpage.cpp index fcbb38b8f..353361e4d 100644 --- a/examples/webenginewidgets/simplebrowser/webpage.cpp +++ b/examples/webenginewidgets/simplebrowser/webpage.cpp @@ -57,6 +57,7 @@ #include #include #include +#include WebPage::WebPage(QWebEngineProfile *profile, QObject *parent) : QWebEnginePage(profile, parent) @@ -65,6 +66,7 @@ WebPage::WebPage(QWebEngineProfile *profile, QObject *parent) connect(this, &QWebEnginePage::featurePermissionRequested, this, &WebPage::handleFeaturePermissionRequested); connect(this, &QWebEnginePage::proxyAuthenticationRequired, this, &WebPage::handleProxyAuthenticationRequired); connect(this, &QWebEnginePage::registerProtocolHandlerRequested, this, &WebPage::handleRegisterProtocolHandlerRequested); + connect(this, &QWebEnginePage::selectClientCertificate, this, &WebPage::handleSelectClientCertificate); } bool WebPage::certificateError(const QWebEngineCertificateError &error) @@ -192,3 +194,9 @@ void WebPage::handleRegisterProtocolHandlerRequested(QWebEngineRegisterProtocolH request.reject(); } //! [registerProtocolHandlerRequested] + +void WebPage::handleSelectClientCertificate(QWebEngineClientCertSelection selection) +{ + // Just select one. + selection.select(selection.certificates().at(0)); +} diff --git a/examples/webenginewidgets/simplebrowser/webpage.h b/examples/webenginewidgets/simplebrowser/webpage.h index 0b9ef2abe..9c33d82df 100644 --- a/examples/webenginewidgets/simplebrowser/webpage.h +++ b/examples/webenginewidgets/simplebrowser/webpage.h @@ -69,6 +69,7 @@ private slots: void handleFeaturePermissionRequested(const QUrl &securityOrigin, Feature feature); void handleProxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth, const QString &proxyHost); void handleRegisterProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request); + void handleSelectClientCertificate(QWebEngineClientCertSelection clientCertSelection); }; #endif // WEBPAGE_H -- cgit v1.2.3