[SCM] ktp-auth-handler packaging branch, master, updated. debian/15.12.1-2-282-g080758e
Maximiliano Curia
maxy at moszumanska.debian.org
Fri May 27 23:59:17 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-auth-handler.git;a=commitdiff;h=897df8b
The following commit has been merged in the master branch:
commit 897df8b17a36e07de87dd176e125a46c16fe5137
Author: Àlex Fiestas <afiestas at kde.org>
Date: Mon Jun 10 16:40:39 2013 +0200
Add support for Google accounts added by mission-control-uoa
Basically we have to implement X-OAUTH2 which besides the generic name
it does not seem to be generic at all.
This code maps 1:1 what Empathy does and of course it is working.
---
CMakeLists.txt | 1 +
sasl-auth-op.cpp | 14 ++++-
x-telepathy-sso-google-operation.cpp | 64 ++++++++++++++++++++++
...ialsjob.h => x-telepathy-sso-google-operation.h | 52 ++++++++----------
4 files changed, 101 insertions(+), 30 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4011542..d6c9883 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,6 +67,7 @@ if(ACCOUNTSQT_FOUND AND SIGNONQT_FOUND)
set(ktp_auth_handler_SRCS
${ktp_auth_handler_SRCS}
x-telepathy-sso-operation.cpp
+ x-telepathy-sso-google-operation.cpp
getcredentialsjob.cpp
)
set(ktp_auth_handler_LIBS
diff --git a/sasl-auth-op.cpp b/sasl-auth-op.cpp
index 9e98739..b8cd65d 100644
--- a/sasl-auth-op.cpp
+++ b/sasl-auth-op.cpp
@@ -25,6 +25,7 @@
#ifdef HAVE_SSO
#include "x-telepathy-sso-operation.h"
+ #include "x-telepathy-sso-google-operation.h"
#endif
#include <QtCore/QScopedPointer>
@@ -84,7 +85,18 @@ void SaslAuthOp::gotProperties(Tp::PendingOperation *op)
QVariantMap errorDetails = qdbus_cast<QVariantMap>(props.value(QLatin1String("SASLErrorDetails")));
authop->onSASLStatusChanged(status, error, errorDetails);
}
- else //if...
+ else if(mechanisms.contains(QLatin1String("X-OAUTH2")) && m_accountStorageId) {
+ XTelepathySSOGoogleOperation *authop = new XTelepathySSOGoogleOperation(m_account, m_accountStorageId, m_saslIface);
+ connect(authop,
+ SIGNAL(finished(Tp::PendingOperation*)),
+ SLOT(onAuthOperationFinished(Tp::PendingOperation*)));
+
+ //FIXME this is repeated code...move it outside the if???
+ uint status = qdbus_cast<uint>(props.value(QLatin1String("SASLStatus")));
+ QString error = qdbus_cast<QString>(props.value(QLatin1String("SASLError")));
+ QVariantMap errorDetails = qdbus_cast<QVariantMap>(props.value(QLatin1String("SASLErrorDetails")));
+ authop->onSASLStatusChanged(status, error, errorDetails);
+ } else //if...
#endif
if (mechanisms.contains(QLatin1String("X-TELEPATHY-PASSWORD"))) {
// everything ok, we can return from handleChannels now
diff --git a/x-telepathy-sso-google-operation.cpp b/x-telepathy-sso-google-operation.cpp
new file mode 100644
index 0000000..94f11e5
--- /dev/null
+++ b/x-telepathy-sso-google-operation.cpp
@@ -0,0 +1,64 @@
+/*************************************************************************************
+ * Copyright (C) 2013 by Alejandro Fiestas Olivares <afiestas at kde.org> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *************************************************************************************/
+
+#include "getcredentialsjob.h"
+#include "x-telepathy-sso-google-operation.h"
+
+#include <KDebug>
+
+XTelepathySSOGoogleOperation::XTelepathySSOGoogleOperation(const Tp::AccountPtr& account, int accountStorageId, Tp::Client::ChannelInterfaceSASLAuthenticationInterface* saslIface)
+ : PendingOperation(account)
+ , m_saslIface(saslIface)
+ , m_accountStorageId(accountStorageId)
+{
+ Q_ASSERT(m_accountStorageId);
+ connect(m_saslIface, SIGNAL(SASLStatusChanged(uint,QString,QVariantMap)), SLOT(onSASLStatusChanged(uint,QString,QVariantMap)));
+}
+
+void XTelepathySSOGoogleOperation::onSASLStatusChanged(uint status, const QString& reason, const QVariantMap& details)
+{
+ switch (status){
+ case Tp::SASLStatusNotStarted:
+ {
+ kDebug() << "Status Not started";
+ GetCredentialsJob *job = new GetCredentialsJob(m_accountStorageId, this);
+ connect(job, SIGNAL(finished(KJob*)), SLOT(gotCredentials(KJob*)));
+ job->start();
+ break;
+ }
+ case Tp::SASLStatusServerSucceeded:
+ kDebug() << "Status Server Succeeded";
+ m_saslIface->AcceptSASL();
+ break;
+ }
+}
+
+void XTelepathySSOGoogleOperation::gotCredentials(KJob* kjob)
+{
+ GetCredentialsJob *job = qobject_cast< GetCredentialsJob* >(kjob);
+ QVariantMap credentialsData = job->credentialsData();
+
+ QByteArray data;
+ data.append("
--
ktp-auth-handler packaging
More information about the pkg-kde-commits
mailing list