Merge lp:~mardy/signon-ui/ignore-ssl-errors into lp:signon-ui

Proposed by Alberto Mardegan
Status: Merged
Approved by: Ken VanDine
Approved revision: 89
Merged at revision: 97
Proposed branch: lp:~mardy/signon-ui/ignore-ssl-errors
Merge into: lp:signon-ui
Prerequisite: lp:~mardy/signon-ui/embed-crash
Diff against target: 101 lines (+27/-1)
2 files modified
debian/changelog (+6/-0)
src/browser-request.cpp (+21/-1)
To merge this branch: bzr merge lp:~mardy/signon-ui/ignore-ssl-errors
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+157043@code.launchpad.net

Commit message

Add flag to ignore SSL errors

Add the possibility of ignoring SSL errors. While this won't be used by
ordinary accounts, we need this for our integration tests: we'll run a local
webserver and test the OAuth 2.0 authentication, which always happens over
HTTPS.

Description of the change

Add flag to ignore SSL errors

Add the possibility of ignoring SSL errors. While this won't be used by
ordinary accounts, we need this for our integration tests: we'll run a local
webserver and test the OAuth 2.0 authentication, which always happens over
HTTPS.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Please update debian/changelog

review: Needs Fixing
88. By Alberto Mardegan

Update from trunk

89. By Alberto Mardegan

Add a flag to disable SSL errors (to be used for integration tests).

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:89
http://jenkins.qa.ubuntu.com/job/signon-ui-ci/19/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/signon-ui-raring-amd64-ci/19

Click here to trigger a rebuild:
http://s-jenkins:8080/job/signon-ui-ci/19/rebuild

review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-05-02 20:48:13 +0000
3+++ debian/changelog 2013-05-10 14:47:26 +0000
4@@ -1,3 +1,9 @@
5+signon-ui (0.14daily13.05.10.1ubuntu.unity.next-0ubuntu2) UNRELEASED; urgency=low
6+
7+ * Add a flag to disable SSL errors (to be used for integration tests).
8+
9+ -- Alberto Mardegan <alberto.mardegan@canonical.com> Fri, 10 May 2013 17:42:04 +0300
10+
11 signon-ui (0.14daily13.05.02.1ubuntu.unity.next-0ubuntu1) raring; urgency=low
12
13 * Automatic snapshot from revision 95 (ubuntu-unity/next)
14
15=== modified file 'src/browser-request.cpp'
16--- src/browser-request.cpp 2013-04-24 09:16:03 +0000
17+++ src/browser-request.cpp 2013-05-10 14:47:26 +0000
18@@ -30,12 +30,14 @@
19 #include <QDesktopServices>
20 #include <QLabel>
21 #include <QNetworkCookie>
22+#include <QNetworkReply>
23 #include <QNetworkRequest>
24 #include <QPointer>
25 #include <QProgressBar>
26 #include <QPushButton>
27 #include <QRegExp>
28 #include <QSettings>
29+#include <QSslError>
30 #include <QStackedLayout>
31 #include <QTimer>
32 #include <QVBoxLayout>
33@@ -68,6 +70,7 @@
34 /* Additional session-data keys we support. */
35 static const QString keyCookies = QString("Cookies");
36 static const QString keyAllowedSchemes = QString("AllowedSchemes");
37+static const QString keyIgnoreSslErrors = QString("IgnoreSslErrors");
38
39 class WebPage: public QWebPage
40 {
41@@ -237,6 +240,7 @@
42 void start();
43
44 private Q_SLOTS:
45+ void onSslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
46 void onUrlChanged(const QUrl &url);
47 void onLoadProgress();
48 void onLoadFinished(bool ok);
49@@ -280,6 +284,7 @@
50 QString m_username;
51 QString m_password;
52 int m_loginCount;
53+ bool m_ignoreSslErrors;
54 QTimer m_failTimer;
55 };
56
57@@ -293,7 +298,8 @@
58 m_webView(0),
59 m_animationLabel(0),
60 m_settings(0),
61- m_loginCount(0)
62+ m_loginCount(0),
63+ m_ignoreSslErrors(false)
64 {
65 m_failTimer.setSingleShot(true);
66 m_failTimer.setInterval(3000);
67@@ -306,6 +312,15 @@
68 delete m_dialog;
69 }
70
71+void BrowserRequestPrivate::onSslErrors(QNetworkReply *reply,
72+ const QList<QSslError> &errors)
73+{
74+ TRACE() << errors;
75+ if (m_ignoreSslErrors) {
76+ reply->ignoreSslErrors();
77+ }
78+}
79+
80 void BrowserRequestPrivate::onUrlChanged(const QUrl &url)
81 {
82 Q_Q(BrowserRequest);
83@@ -431,6 +446,9 @@
84 WebPage *page = new WebPage(this);
85 QObject::connect(page, SIGNAL(contentsChanged()),
86 this, SLOT(onContentsChanged()));
87+ QObject::connect(page->networkAccessManager(),
88+ SIGNAL(sslErrors(QNetworkReply*,const QList<QSslError> &)),
89+ this, SLOT(onSslErrors(QNetworkReply*,const QList<QSslError> &)));
90 m_webView->setPage(page);
91
92 /* The following couple of lines serve to instruct the QWebPage not to load
93@@ -459,6 +477,8 @@
94 page->setAllowedSchemes(QStringList("https"));
95 }
96
97+ m_ignoreSslErrors = clientData.value(keyIgnoreSslErrors, false).toBool();
98+
99 QUrl url(params.value(SSOUI_KEY_OPENURL).toString());
100 setupViewForUrl(url);
101 QObject::connect(m_webView, SIGNAL(urlChanged(const QUrl&)),

Subscribers

People subscribed via source and target branches

to all changes: