[Pkg-owncloud-commits] [owncloud-client] 32/60: Shibboleth: Upgrade to OAuth2 When the server supports it
Sandro Knauß
hefee at debian.org
Sat Dec 16 10:38:13 UTC 2017
This is an automated email from the git hooks/post-receive script.
hefee pushed a commit to branch upstream
in repository owncloud-client.
commit ee98daf9ea6d92d0827c2b87637ec548990f1fae
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Fri Dec 1 13:24:52 2017 +0100
Shibboleth: Upgrade to OAuth2 When the server supports it
If the server support both Shibboleth and OAuth2, upgrades to OAuth2
Issue #6198
---
src/gui/creds/shibbolethcredentials.cpp | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/gui/creds/shibbolethcredentials.cpp b/src/gui/creds/shibbolethcredentials.cpp
index 32b3008..ae15699 100644
--- a/src/gui/creds/shibbolethcredentials.cpp
+++ b/src/gui/creds/shibbolethcredentials.cpp
@@ -23,6 +23,7 @@
#include "creds/shibbolethcredentials.h"
#include "shibboleth/shibbolethuserjob.h"
#include "creds/credentialscommon.h"
+#include "creds/httpcredentialsgui.h"
#include "accessmanager.h"
#include "account.h"
@@ -151,7 +152,31 @@ void ShibbolethCredentials::fetchFromKeychainHelper()
void ShibbolethCredentials::askFromUser()
{
- showLoginWindow();
+ // First, we do a DetermineAuthTypeJob to make sure that the server is still using shibboleth and did not upgrade to oauth
+ DetermineAuthTypeJob *job = new DetermineAuthTypeJob(_account->sharedFromThis(), this);
+ connect(job, &DetermineAuthTypeJob::authType, [this, job](DetermineAuthTypeJob::AuthType type) {
+ if (type == DetermineAuthTypeJob::Shibboleth) {
+ // Normal case, still shibboleth
+ showLoginWindow();
+ } else if (type == DetermineAuthTypeJob::OAuth) {
+ // Hack: upgrade to oauth
+ auto newCred = new HttpCredentialsGui;
+ job->setParent(0);
+ job->deleteLater();
+ auto account = this->_account;
+ auto user = this->_user;
+ account->setCredentials(newCred); // delete this
+ account->setCredentialSetting(QLatin1String("user"), user);
+ newCred->fetchUser();
+ newCred->askFromUser();
+ } else {
+ // Basic auth or unkown. Since it may be unkown it might be a temporary failure, don't replace the credentials here
+ // Still show the login window in that case not to break the flow.
+ showLoginWindow();
+ }
+
+ });
+ job->start();
}
bool ShibbolethCredentials::stillValid(QNetworkReply *reply)
--
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