[Pkg-owncloud-commits] [owncloud-client] 65/70: Shibboleth: keep the cookie from the wizard to the ShibolethCredentials
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Jul 1 10:21:24 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 9adc30ab9f818466e4d041aab924885b62e7b780
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Tue Jun 24 11:41:29 2014 +0200
Shibboleth: keep the cookie from the wizard to the ShibolethCredentials
Otherwise the user is asked twice for autentication on first sync.
Fixes https://github.com/owncloud/enterprise/issues/193
---
src/creds/shibboleth/shibbolethuserjob.h | 4 +---
src/creds/shibbolethcredentials.cpp | 17 +++++++++++++++++
src/creds/shibbolethcredentials.h | 3 +++
src/wizard/owncloudshibbolethcredspage.cpp | 10 +++++++---
src/wizard/owncloudshibbolethcredspage.h | 3 ++-
5 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/src/creds/shibboleth/shibbolethuserjob.h b/src/creds/shibboleth/shibbolethuserjob.h
index f6427a4..8042fe9 100644
--- a/src/creds/shibboleth/shibbolethuserjob.h
+++ b/src/creds/shibboleth/shibbolethuserjob.h
@@ -26,15 +26,13 @@ class ShibbolethUserJob : public AbstractNetworkJob {
Q_OBJECT
public:
explicit ShibbolethUserJob(Account *account, QObject* parent = 0);
+public slots:
void start();
signals:
// is always emitted when the job is finished. user is empty in case of error.
void userFetched(const QString &user);
- // Another job need to be created
- void tryAgain();
-
private slots:
virtual bool finished();
};
diff --git a/src/creds/shibbolethcredentials.cpp b/src/creds/shibbolethcredentials.cpp
index bf8fea4..5b83f70 100644
--- a/src/creds/shibbolethcredentials.cpp
+++ b/src/creds/shibbolethcredentials.cpp
@@ -94,6 +94,23 @@ ShibbolethCredentials::ShibbolethCredentials()
_browser(0)
{}
+ShibbolethCredentials::ShibbolethCredentials(const QNetworkCookie& cookie, Account* account)
+ : _ready(true),
+ _stillValid(true),
+ _fetchJobInProgress(false),
+ _browser(0),
+ _shibCookie(cookie)
+{
+ if (account) {
+ /* The _user has not yet been fetched, so fetch it now */
+ ShibbolethUserJob *job = new ShibbolethUserJob(account, this);
+ connect(job, SIGNAL(userFetched(QString)), this, SLOT(slotUserFetched(QString)));
+ QTimer::singleShot(1234, job, SLOT(start()));
+
+ }
+}
+
+
void ShibbolethCredentials::syncContextPreInit(CSYNC* ctx)
{
csync_set_auth_callback (ctx, handleNeonSSLProblems);
diff --git a/src/creds/shibbolethcredentials.h b/src/creds/shibbolethcredentials.h
index 85efe51..cb778f2 100644
--- a/src/creds/shibbolethcredentials.h
+++ b/src/creds/shibbolethcredentials.h
@@ -40,6 +40,9 @@ Q_OBJECT
public:
ShibbolethCredentials();
+ /* create a credidentials for an already connected account */
+ ShibbolethCredentials(const QNetworkCookie &cookie, Account *acc);
+
void syncContextPreInit(CSYNC* ctx);
void syncContextPreStart(CSYNC* ctx);
bool changed(AbstractCredentials* credentials) const;
diff --git a/src/wizard/owncloudshibbolethcredspage.cpp b/src/wizard/owncloudshibbolethcredspage.cpp
index 40053d6..6535707 100644
--- a/src/wizard/owncloudshibbolethcredspage.cpp
+++ b/src/wizard/owncloudshibbolethcredspage.cpp
@@ -48,7 +48,7 @@ void OwncloudShibbolethCredsPage::setupBrowser()
_browser = new ShibbolethWebView(account);
connect(_browser, SIGNAL(shibbolethCookieReceived(const QNetworkCookie&, Account*)),
- this, SLOT(slotShibbolethCookieReceived()), Qt::QueuedConnection);
+ this, SLOT(slotShibbolethCookieReceived(const QNetworkCookie&, Account*)), Qt::QueuedConnection);
connect(_browser, SIGNAL(rejected()),
this, SLOT(slotBrowserRejected()));
@@ -92,11 +92,15 @@ void OwncloudShibbolethCredsPage::setConnected()
AbstractCredentials* OwncloudShibbolethCredsPage::getCredentials() const
{
- return new ShibbolethCredentials;
+ const OwncloudWizard *ocWizard = static_cast<const OwncloudWizard*>(wizard());
+ Account *account = ocWizard->account();
+
+ return new ShibbolethCredentials(_cookie, account);
}
-void OwncloudShibbolethCredsPage::slotShibbolethCookieReceived()
+void OwncloudShibbolethCredsPage::slotShibbolethCookieReceived(const QNetworkCookie &cookie, Account*)
{
+ _cookie = cookie;
emit connectToOCUrl(field("OCUrl").toString().simplified());
}
diff --git a/src/wizard/owncloudshibbolethcredspage.h b/src/wizard/owncloudshibbolethcredspage.h
index a9db292..28f6353 100644
--- a/src/wizard/owncloudshibbolethcredspage.h
+++ b/src/wizard/owncloudshibbolethcredspage.h
@@ -46,7 +46,7 @@ public Q_SLOTS:
void setVisible(bool visible);
private Q_SLOTS:
- void slotShibbolethCookieReceived();
+ void slotShibbolethCookieReceived(const QNetworkCookie&, Account*);
void slotBrowserRejected();
private:
@@ -54,6 +54,7 @@ private:
QPointer<ShibbolethWebView> _browser;
bool _afterInitialSetup;
+ QNetworkCookie _cookie;
};
} // ns Mirall
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list