mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 14:05:58 +03:00
Allow to use the login flow with a self signed certificate
The QWebEngine uses a different certificate store/system. So we can't just pass wour accepted certificates in there. As a work around we now trust the url we set by definition. As this has to already be approved before we access this. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
f2bc5c0482
commit
668c53a0af
1 changed files with 20 additions and 0 deletions
|
@ -41,6 +41,13 @@ class WebEnginePage : public QWebEnginePage {
|
|||
public:
|
||||
WebEnginePage(QWebEngineProfile *profile, QObject* parent = nullptr);
|
||||
QWebEnginePage * createWindow(QWebEnginePage::WebWindowType type) override;
|
||||
void setUrl(const QUrl &url);
|
||||
|
||||
protected:
|
||||
bool certificateError(const QWebEngineCertificateError &certificateError) override;
|
||||
|
||||
private:
|
||||
QUrl _rootUrl;
|
||||
};
|
||||
|
||||
// We need a separate class here, since we cannot simply return the same WebEnginePage object
|
||||
|
@ -146,6 +153,19 @@ QWebEnginePage * WebEnginePage::createWindow(QWebEnginePage::WebWindowType type)
|
|||
return view;
|
||||
}
|
||||
|
||||
void WebEnginePage::setUrl(const QUrl &url) {
|
||||
QWebEnginePage::setUrl(url);
|
||||
_rootUrl = url;
|
||||
}
|
||||
|
||||
bool WebEnginePage::certificateError(const QWebEngineCertificateError &certificateError) {
|
||||
if (certificateError.error() == QWebEngineCertificateError::CertificateAuthorityInvalid) {
|
||||
return certificateError.url().host() == _rootUrl.host();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ExternalWebEnginePage::ExternalWebEnginePage(QWebEngineProfile *profile, QObject* parent) : QWebEnginePage(profile, parent) {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue