Hello community, here is the log from the commit of package ktp-auth-handler for openSUSE:Factory checked in at 2013-10-08 10:54:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ktp-auth-handler (Old) and /work/SRC/openSUSE:Factory/.ktp-auth-handler.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ktp-auth-handler" Changes: -------- --- /work/SRC/openSUSE:Factory/ktp-auth-handler/ktp-auth-handler.changes 2013-09-25 14:31:47.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ktp-auth-handler.new/ktp-auth-handler.changes 2013-10-08 10:54:04.000000000 +0200 @@ -1,0 +2,6 @@ +Thu Sep 26 22:02:10 UTC 2013 - [email protected] + +- Update to version 0.6.80 + * New feature release, please see http://www.sharpley.org.uk/blog/ktp-0.7-beta + +------------------------------------------------------------------- Old: ---- ktp-auth-handler-0.6.3.tar.bz2 New: ---- ktp-auth-handler-0.6.80.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ktp-auth-handler.spec ++++++ --- /var/tmp/diff_new_pack.2aHtJh/_old 2013-10-08 10:54:04.000000000 +0200 +++ /var/tmp/diff_new_pack.2aHtJh/_new 2013-10-08 10:54:04.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package ktp-auth-handler # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -11,24 +11,26 @@ # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# + # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + Name: ktp-auth-handler -Version: 0.6.3 -Release: 1 -License: LGPL-2.1+ +Version: 0.6.80 +Release: 0 Summary: Telepathy auth handler -Url: http://community.kde.org/Real-Time_Communication_and_Collaboration +License: LGPL-2.1+ Group: Productivity/Networking/Instant Messenger -Source0: http://download.kde.org/stable/kde-telepathy/%{version}/src/%{name}-%{version}.tar.bz2 +Url: http://community.kde.org/Real-Time_Communication_and_Collaboration +Source0: http://download.kde.org/unstable/kde-telepathy/%{version}/src/%{name}-%{version}.tar.bz2 BuildRequires: fdupes +BuildRequires: ktp-common-internals-devel BuildRequires: libkde4-devel >= 4.4.75 +BuildRequires: libqca2-devel +BuildRequires: libqjson-devel BuildRequires: libqjson-devel -BuildRequires: ktp-common-internals-devel BuildRequires: telepathy-qt4-devel >= 0.8.9 -BuildRequires: libqca2-devel libqjson-devel Recommends: %{name}-lang BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ ktp-auth-handler-0.6.3.tar.bz2 -> ktp-auth-handler-0.6.80.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/CMakeLists.txt new/ktp-auth-handler-0.6.80/CMakeLists.txt --- old/ktp-auth-handler-0.6.3/CMakeLists.txt 2013-08-06 03:16:16.000000000 +0200 +++ new/ktp-auth-handler-0.6.80/CMakeLists.txt 2013-09-23 23:17:02.000000000 +0200 @@ -1,6 +1,6 @@ project(ktp-auth-handler) -set(KTP_AUTH_HANDLER_VERSION "0.6.3") +set(KTP_AUTH_HANDLER_VERSION "0.6.80") set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" @@ -15,10 +15,16 @@ find_package (KTp REQUIRED) find_package (QJSON REQUIRED) find_package (QCA2 REQUIRED) +find_package (AccountsQt) +find_package (SignOnQt) include (KDE4Defaults) include (MacroLibrary) +macro_log_feature(ACCOUNTSQT_FOUND "AccountsQt" "Support for Accounts-SSO" "https://code.google.com/p/accounts-sso/source/checkout?repo=libaccounts-qt" FALSE "" "") +macro_log_feature(SIGNONQT_FOUND "SignonsQt" "Support for Accounts-SSO" "https://code.google.com/p/accounts-sso/source/checkout?repo=signond" FALSE "" "") +macro_display_feature_log() + add_definitions (${KDE4_DEFINITIONS}) include_directories (${KDE4_INCLUDES} @@ -44,12 +50,7 @@ conference-auth-observer.cpp ) -configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) - -kde4_add_ui_files(ktp_auth_handler_SRCS x-telepathy-password-prompt.ui) -kde4_add_executable(ktp-auth-handler ${ktp_auth_handler_SRCS}) - -target_link_libraries(ktp-auth-handler +set(ktp_auth_handler_LIBS ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY} @@ -64,17 +65,49 @@ ${QCA2_LIBRARIES} ) +#If we find Accounts-SSO frameworks, add support for it +if(ACCOUNTSQT_FOUND AND SIGNONQT_FOUND) + + add_definitions(-DHAVE_SSO) + set(ktp_auth_handler_SRCS + ${ktp_auth_handler_SRCS} + x-telepathy-sso-facebook-operation.cpp + x-telepathy-sso-google-operation.cpp + getcredentialsjob.cpp + ) + + set(ktp_auth_handler_LIBS + ${ktp_auth_handler_LIBS} + ${ACCOUNTSQT_LIBRARIES} + ${SIGNONQT_LIBRARIES} + ) + + include_directories(${ACCOUNTSQT_INCLUDE_DIRS} + ${SIGNONQT_INCLUDE_DIRS} + ) + +endif(ACCOUNTSQT_FOUND AND SIGNONQT_FOUND) + +configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) + +kde4_add_ui_files(ktp_auth_handler_SRCS x-telepathy-password-prompt.ui) +kde4_add_executable(ktp-auth-handler ${ktp_auth_handler_SRCS}) + +target_link_libraries(ktp-auth-handler + ${ktp_auth_handler_LIBS} +) + configure_file(org.freedesktop.Telepathy.Client.KTp.SASLHandler.service.in ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.KTp.SASLHandler.service) configure_file(org.freedesktop.Telepathy.Client.KTp.TLSHandler.service.in ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.KTp.TLSHandler.service) configure_file(org.freedesktop.Telepathy.Client.KTp.ConfAuthObserver.service.in - ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.KTp.ConfAuthObserver.service) + ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.KTp.ConfAuthObserver.service) install(TARGETS ktp-auth-handler DESTINATION ${LIBEXEC_INSTALL_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.KTp.SASLHandler.service - ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.KTp.ConfAuthObserver.service + ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.KTp.ConfAuthObserver.service DESTINATION ${DBUS_SERVICES_INSTALL_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.KTp.TLSHandler.service DESTINATION ${DBUS_SERVICES_INSTALL_DIR}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/cmake/modules/FindAccountsQt.cmake new/ktp-auth-handler-0.6.80/cmake/modules/FindAccountsQt.cmake --- old/ktp-auth-handler-0.6.3/cmake/modules/FindAccountsQt.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/ktp-auth-handler-0.6.80/cmake/modules/FindAccountsQt.cmake 2013-09-23 23:15:40.000000000 +0200 @@ -0,0 +1,23 @@ +# - Try to find AccountsQt +# Once done this will define +# ACCOUNTSQT_FOUND - System has libaccounts-qt +# ACCOUNTSQT_INCLUDE_DIRS - The libaccounts-qt include directories +# ACCOUNTSQT_LIBRARIES - The libraries needed to use libaccounts-qt + +find_path(ACCOUNTSQT_INCLUDE_DIR Accounts/Account + HINTS ${CMAKE_INSTALL_PREFIX}/include + PATH_SUFFIXES accounts-qt ) + +find_library(ACCOUNTSQT_LIBRARY NAMES accounts-qt libaccounts-qt + HINTS ${CMAKE_INSTALL_PREFIX}/lib64) + +set(ACCOUNTSQT_LIBRARIES ${ACCOUNTSQT_LIBRARY} ) +set(ACCOUNTSQT_INCLUDE_DIRS ${ACCOUNTSQT_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set ACCOUNTSQT_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(accountsqt DEFAULT_MSG + ACCOUNTSQT_LIBRARY ACCOUNTSQT_INCLUDE_DIR) + +mark_as_advanced(ACCOUNTSQT_INCLUDE_DIR ACCOUNTSQT_LIBRARY ) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/cmake/modules/FindSignOnQt.cmake new/ktp-auth-handler-0.6.80/cmake/modules/FindSignOnQt.cmake --- old/ktp-auth-handler-0.6.3/cmake/modules/FindSignOnQt.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/ktp-auth-handler-0.6.80/cmake/modules/FindSignOnQt.cmake 2013-09-23 23:15:40.000000000 +0200 @@ -0,0 +1,20 @@ +# - Try to find SignOnQt +# Once done this will define +# SIGNONQT_FOUND - System has libsignon-qt +# SIGNONQT_INCLUDE_DIRS - The libsignon-qt include directories +# SIGNONQT_LIBRARIES - The libraries needed to use libsignon-qt + +find_path(SIGNONQT_INCLUDE_DIR SignOn/AuthService PATH_SUFFIXES signon-qt ) + +find_library(SIGNONQT_LIBRARY NAMES signon-qt libsignon-qt) + +set(SIGNONQT_LIBRARIES ${SIGNONQT_LIBRARY} ) +set(SIGNONQT_INCLUDE_DIRS ${SIGNONQT_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set SIGNONQT_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(signonqt DEFAULT_MSG + SIGNONQT_LIBRARY SIGNONQT_INCLUDE_DIR) + +mark_as_advanced(SIGNONQT_INCLUDE_DIR SIGNONQT_LIBRARY ) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/getcredentialsjob.cpp new/ktp-auth-handler-0.6.80/getcredentialsjob.cpp --- old/ktp-auth-handler-0.6.3/getcredentialsjob.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/ktp-auth-handler-0.6.80/getcredentialsjob.cpp 2013-09-23 23:15:40.000000000 +0200 @@ -0,0 +1,106 @@ +/************************************************************************************* + * Copyright (C) 2013 by Alejandro Fiestas Olivares <[email protected]> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser 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 <Accounts/Manager> +#include <Accounts/Account> +#include <Accounts/AccountService> + +#include <SignOn/Identity> + +#include <KDebug> + +GetCredentialsJob::GetCredentialsJob(const Accounts::AccountId& id, QObject* parent) +: KJob(parent) +, m_id(id) +, m_manager(new Accounts::Manager(this)) +{ + +} + +void GetCredentialsJob::start() +{ + QMetaObject::invokeMethod(this, "getCredentials", Qt::QueuedConnection); +} + +void GetCredentialsJob::setServiceType(const QString& serviceType) +{ + m_serviceType = serviceType; +} + +void GetCredentialsJob::getCredentials() +{ + Accounts::Account *acc = m_manager->account(m_id); + if (!acc) { + setError(-1); + setErrorText("Could not find account"); + emitResult(); + return; + } + Accounts::AccountService *service = new Accounts::AccountService(acc, m_manager->service(m_serviceType), this); + + Accounts::AuthData authData = service->authData(); + m_authData = authData.parameters(); + SignOn::Identity* identity = SignOn::Identity::existingIdentity(authData.credentialsId(), this); + + if (!identity) { + setError(-1); + setErrorText("Could not find credentials"); + emitResult(); + return; + } + + m_authData["AccountUsername"] = acc->value("username").toString(); + QPointer<SignOn::AuthSession> authSession = identity->createSession(authData.method()); + + connect(authSession, SIGNAL(response(SignOn::SessionData)), + SLOT(sessionResponse(SignOn::SessionData))); + connect(authSession, SIGNAL(error(SignOn::Error)), + SLOT(sessionError(SignOn::Error))); + + kDebug() << authData.parameters(); + kDebug() << authData.mechanism(); + authSession->process(authData.parameters(), authData.mechanism()); +} + +void GetCredentialsJob::sessionResponse(const SignOn::SessionData& data) +{ + kDebug() << data.toMap(); + m_sessionData = data; + emitResult(); +} + +void GetCredentialsJob::sessionError(const SignOn::Error& error) +{ + kDebug() << error.message(); + setError(-1); + setErrorText(error.message()); + emitResult(); +} + +Accounts::AccountId GetCredentialsJob::accountId() const +{ + return m_id; +} + +QVariantMap GetCredentialsJob::credentialsData() const +{ + return m_sessionData.toMap().unite(m_authData); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/getcredentialsjob.h new/ktp-auth-handler-0.6.80/getcredentialsjob.h --- old/ktp-auth-handler-0.6.3/getcredentialsjob.h 1970-01-01 01:00:00.000000000 +0100 +++ new/ktp-auth-handler-0.6.80/getcredentialsjob.h 2013-09-23 23:15:40.000000000 +0200 @@ -0,0 +1,61 @@ +/************************************************************************************* + * Copyright (C) 2013 by Alejandro Fiestas Olivares <[email protected]> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser 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. * + *************************************************************************************/ + +#ifndef GET_CREDENTIALS_JOB_H +#define GET_CREDENTIALS_JOB_H + +#include <kjob.h> + +#include <Accounts/Account> +#include <Accounts/AuthData> +#include <SignOn/SessionData> + +namespace Accounts { + class Manager; +}; +namespace SignOn { + class Error; +}; + +class GetCredentialsJob : public KJob +{ + Q_OBJECT +public: + explicit GetCredentialsJob(const Accounts::AccountId &id, QObject* parent = 0); + virtual void start(); + + void setServiceType(const QString &serviceType); + + QVariantMap credentialsData() const; + Accounts::AccountId accountId() const; + +private Q_SLOTS: + void getCredentials(); + void sessionResponse(const SignOn::SessionData &data); + void sessionError(const SignOn::Error &error); + +private: + QString m_serviceType; + Accounts::AccountId m_id; + QVariantMap m_authData; + Accounts::Manager *m_manager; + SignOn::SessionData m_sessionData; +}; + +#endif //GET_CREDENTIALS_JOB_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/po/nb/ktp-auth-handler.po new/ktp-auth-handler-0.6.80/po/nb/ktp-auth-handler.po --- old/ktp-auth-handler-0.6.3/po/nb/ktp-auth-handler.po 2013-08-06 03:15:38.000000000 +0200 +++ new/ktp-auth-handler-0.6.80/po/nb/ktp-auth-handler.po 2013-09-23 23:16:30.000000000 +0200 @@ -1,19 +1,19 @@ # Translation of ktp-auth-handler to Norwegian Bokmål # -# Bjørn Steensrud <[email protected]>, 2012. +# Bjørn Steensrud <[email protected]>, 2012, 2013. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2013-07-20 05:08+0000\n" -"PO-Revision-Date: 2012-12-10 21:58+0100\n" +"PO-Revision-Date: 2013-09-17 21:17+0200\n" "Last-Translator: Bjørn Steensrud <[email protected]>\n" "Language-Team: Norwegian Bokmål <[email protected]>\n" "Language: nb\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.4\n" +"X-Generator: Lokalize 1.5\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Environment: kde\n" "X-Accelerator-Marker: &\n" @@ -25,7 +25,7 @@ msgctxt "EMAIL OF TRANSLATORS" msgid "Your emails" -msgstr " " +msgstr "[email protected]" #: conference-auth-op.cpp:94 #, kde-format @@ -54,10 +54,12 @@ "The server failed the authenticity check (%1).\n" "\n" msgstr "" +"Tjeneren besto ikke autentitetstesten (%1).\n" +"\n" #: tls-cert-verifier-op.cpp:148 tls-cert-verifier-op.cpp:166 msgid "Server Authentication" -msgstr "" +msgstr "Tjenerautentisering" #: tls-cert-verifier-op.cpp:149 msgid "&Details" @@ -65,24 +67,24 @@ #: tls-cert-verifier-op.cpp:150 msgid "Co&ntinue" -msgstr "" +msgstr "For&tsett" #: tls-cert-verifier-op.cpp:151 msgid "&Cancel" -msgstr "" +msgstr "&Avbryt" #: tls-cert-verifier-op.cpp:163 msgid "" "Would you like to accept this certificate forever without being prompted?" -msgstr "" +msgstr "Vil du godta dette sertifikatet for alltid uten å bli spurt igjen?" #: tls-cert-verifier-op.cpp:167 msgid "&Forever" -msgstr "" +msgstr "&For alltid" #: tls-cert-verifier-op.cpp:168 msgid "&Current Session only" -msgstr "" +msgstr "&Bare gjeldende økt" #: x-messenger-oauth2-auth-operation.cpp:106 #: x-telepathy-password-auth-operation.cpp:84 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/sasl-auth-op.cpp new/ktp-auth-handler-0.6.80/sasl-auth-op.cpp --- old/ktp-auth-handler-0.6.3/sasl-auth-op.cpp 2013-08-06 03:14:58.000000000 +0200 +++ new/ktp-auth-handler-0.6.80/sasl-auth-op.cpp 2013-09-23 23:15:40.000000000 +0200 @@ -19,9 +19,17 @@ */ #include "sasl-auth-op.h" + #include "x-telepathy-password-auth-operation.h" #include "x-messenger-oauth2-auth-operation.h" +#ifdef HAVE_SSO + #include "x-telepathy-sso-facebook-operation.h" + #include "x-telepathy-sso-google-operation.h" +#endif + +#include <QtCore/QScopedPointer> + #include <TelepathyQt/PendingVariantMap> #include <KDebug> @@ -38,6 +46,11 @@ m_channel(channel), m_saslIface(channel->interface<Tp::Client::ChannelInterfaceSASLAuthenticationInterface>()) { +#ifdef HAVE_SSO + m_accountStorageId = 0; +#endif + + //FIXME: We should open the wallet only when required (not required for X-FACEBOOK-PLATFORM) connect(KTp::WalletInterface::openWallet(), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onOpenWalletOperationFinished(Tp::PendingOperation*))); } @@ -59,33 +72,49 @@ QStringList mechanisms = qdbus_cast<QStringList>(props.value(QLatin1String("AvailableMechanisms"))); kDebug() << mechanisms; + 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"))); + +#ifdef HAVE_SSO + if (mechanisms.contains(QLatin1String("X-FACEBOOK-PLATFORM")) && m_accountStorageId) { + XTelepathySSOFacebookOperation *authop = new XTelepathySSOFacebookOperation(m_account, m_accountStorageId, m_saslIface); + connect(authop, + SIGNAL(finished(Tp::PendingOperation*)), + SLOT(onAuthOperationFinished(Tp::PendingOperation*))); + + authop->onSASLStatusChanged(status, error, errorDetails); + } + 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*))); + + authop->onSASLStatusChanged(status, error, errorDetails); + } else //if... +#endif if (mechanisms.contains(QLatin1String("X-TELEPATHY-PASSWORD"))) { - // everything ok, we can return from handleChannels now Q_EMIT ready(this); XTelepathyPasswordAuthOperation *authop = new XTelepathyPasswordAuthOperation(m_account, m_saslIface, m_walletInterface, qdbus_cast<bool>(props.value(QLatin1String("CanTryAgain")))); connect(authop, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onAuthOperationFinished(Tp::PendingOperation*))); - 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 (mechanisms.contains(QLatin1String("X-MESSENGER-OAUTH2"))) { - // everything ok, we can return from handleChannels now Q_EMIT ready(this); XMessengerOAuth2AuthOperation *authop = new XMessengerOAuth2AuthOperation(m_account, m_saslIface, m_walletInterface); connect(authop, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onAuthOperationFinished(Tp::PendingOperation*))); - 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 { - kWarning() << "X-TELEPATHY-PASSWORD and X-MESSENGER-OAUTH2 are the only supported SASL mechanism and are not available:" << mechanisms; + kWarning() << "X-TELEPATHY-PASSWORD, X-MESSENGER-OAUTH2, X-OAUTH2, X-FACEBOOK_PLATFORM are the only supported SASL mechanism and are not available:" << mechanisms; m_channel->requestClose(); setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, - QLatin1String("X-TELEPATHY-PASSWORD and X-MESSENGER-OAUTH2 are the only supported SASL mechanism and are not available")); + QLatin1String("X-TELEPATHY-PASSWORD, X-MESSENGER-OAUTH2, X-OAUTH2, X-FACEBOOK_PLATFORM are the only supported SASL mechanism and are not available:")); return; } } @@ -97,9 +126,11 @@ m_walletInterface = walletOp->walletInterface(); - connect(m_saslIface->requestAllProperties(), - SIGNAL(finished(Tp::PendingOperation*)), - SLOT(gotProperties(Tp::PendingOperation*))); +#ifdef HAVE_SSO + fetchAccountStorage(); +#else + setReady(); +#endif } void SaslAuthOp::onAuthOperationFinished(Tp::PendingOperation *op) @@ -112,4 +143,35 @@ } } +void SaslAuthOp::setReady() +{ + connect(m_saslIface->requestAllProperties(), + SIGNAL(finished(Tp::PendingOperation*)), + SLOT(gotProperties(Tp::PendingOperation*))); +} + +#ifdef HAVE_SSO +void SaslAuthOp::onGetAccountStorageFetched(Tp::PendingOperation* op) +{ + kDebug(); + Tp::PendingVariantMap *pendingMap = qobject_cast<Tp::PendingVariantMap*>(op); + + m_accountStorageId = pendingMap->result()["StorageIdentifier"].value<QDBusVariant>().variant().toInt(); + kDebug() << m_accountStorageId; + + setReady(); +} + +void SaslAuthOp::fetchAccountStorage() +{ + //Check if the account has any StorageIdentifier, in which case we will + //prioritize those mechanism related with KDE Accounts integration + QScopedPointer<Tp::Client::AccountInterfaceStorageInterface> accountStorageInterface( + new Tp::Client::AccountInterfaceStorageInterface(m_account->busName(), m_account->objectPath())); + + Tp::PendingVariantMap *pendingMap = accountStorageInterface->requestAllProperties(); + connect(pendingMap, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onGetAccountStorageFetched(Tp::PendingOperation*))); +} +#endif + #include "sasl-auth-op.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/sasl-auth-op.h new/ktp-auth-handler-0.6.80/sasl-auth-op.h --- old/ktp-auth-handler-0.6.3/sasl-auth-op.h 2013-08-06 03:14:58.000000000 +0200 +++ new/ktp-auth-handler-0.6.80/sasl-auth-op.h 2013-09-23 23:15:40.000000000 +0200 @@ -46,11 +46,23 @@ void onOpenWalletOperationFinished(Tp::PendingOperation *op); void onAuthOperationFinished(Tp::PendingOperation *op); +#ifdef HAVE_SSO + //FIXME this is a workaround until Tp::Client::AccountInterfaceStorageInterface is merged into Tp::Account + //https://bugs.freedesktop.org/show_bug.cgi?id=63191 + void onGetAccountStorageFetched(Tp::PendingOperation *op); +#endif + private: + void setReady(); KTp::WalletInterface *m_walletInterface; Tp::AccountPtr m_account; Tp::ChannelPtr m_channel; Tp::Client::ChannelInterfaceSASLAuthenticationInterface *m_saslIface; + +#ifdef HAVE_SSO + void fetchAccountStorage(); + int m_accountStorageId; +#endif }; #endif // SASL_AUTH_OP_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/tls-cert-verifier-op.cpp new/ktp-auth-handler-0.6.80/tls-cert-verifier-op.cpp --- old/ktp-auth-handler-0.6.3/tls-cert-verifier-op.cpp 2013-08-06 03:14:58.000000000 +0200 +++ new/ktp-auth-handler-0.6.80/tls-cert-verifier-op.cpp 2013-09-23 23:15:40.000000000 +0200 @@ -118,12 +118,9 @@ // Find all errors then are not ignored by the rule QList<KSslError> errors; - Q_FOREACH(const QCA::Certificate &cert, chain) { - QCA::Validity validity = cert.validate(CACollection(), QCA::CertificateCollection(), QCA::UsageTLSClient, QCA::ValidateAll); - if (validity == QCA::ValidityGood) { - continue; - } + QCA::Validity validity = chain.validate(CACollection()); + if (validity != QCA::ValidityGood) { KSslError::Error error = validityToError(validity); if (!rule.ignoredErrors().contains(error)) { errors << KSslError(error); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/x-telepathy-sso-facebook-operation.cpp new/ktp-auth-handler-0.6.80/x-telepathy-sso-facebook-operation.cpp --- old/ktp-auth-handler-0.6.3/x-telepathy-sso-facebook-operation.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/ktp-auth-handler-0.6.80/x-telepathy-sso-facebook-operation.cpp 2013-09-23 23:15:41.000000000 +0200 @@ -0,0 +1,99 @@ +/* + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 2013 David Edmundson <[email protected]> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "x-telepathy-sso-facebook-operation.h" + +#include <TelepathyQt/Account> +#include <TelepathyQt/ChannelInterfaceSASLAuthenticationInterface> +#include <TelepathyQt/AccountInterfaceStorageInterface> + +#include <TelepathyQt/PendingVariantMap> + +#include <Accounts/Account> + +#include <KDebug> +#include <KUrl> + +#include "getcredentialsjob.h" + +XTelepathySSOFacebookOperation::XTelepathySSOFacebookOperation(const Tp::AccountPtr& account, int accountStorageId, Tp::Client::ChannelInterfaceSASLAuthenticationInterface* saslIface) : + PendingOperation(account), + m_account(account), + m_saslIface(saslIface), + m_accountStorageId(accountStorageId) +{ + Q_ASSERT(m_accountStorageId); + connect(m_saslIface, SIGNAL(SASLStatusChanged(uint,QString,QVariantMap)), SLOT(onSASLStatusChanged(uint,QString,QVariantMap))); + connect(m_saslIface, SIGNAL(NewChallenge(QByteArray)), SLOT(onNewChallenge(QByteArray))); +} + + +void XTelepathySSOFacebookOperation::onSASLStatusChanged(uint status, const QString &reason, const QVariantMap &details) +{ + kDebug() << "New status is: " << status; + kDebug() << "Details: " << details; + kDebug() << "Reason: " << reason; + + switch (status){ + case Tp::SASLStatusNotStarted: + { + kDebug() << "starting credentials job"; + m_saslIface->StartMechanism(QLatin1String("X-FACEBOOK-PLATFORM")); + break; + } + case Tp::SASLStatusServerSucceeded: + kDebug() << "Authentication handshake"; + m_saslIface->AcceptSASL(); + break; + } +} + +void XTelepathySSOFacebookOperation::onNewChallenge(const QByteArray& challengeData) +{ + kDebug() << "New Challenge" << challengeData; + + m_challengeData = challengeData; + + kDebug() << "GetCredentialsJob on account: " << m_accountStorageId; + GetCredentialsJob *job = new GetCredentialsJob(m_accountStorageId, this); + connect(job, SIGNAL(finished(KJob*)), SLOT(gotCredentials(KJob *))); + job->start(); +} + +void XTelepathySSOFacebookOperation::gotCredentials(KJob *kJob) +{ + kDebug(); + KUrl fbRequestUrl; + KUrl fbResponseUrl; + + fbRequestUrl.setQuery(m_challengeData); + kDebug() << fbRequestUrl.queryItemValue("version"); + + GetCredentialsJob *job = qobject_cast< GetCredentialsJob* >(kJob); + QVariantMap credentialsData = job->credentialsData(); + fbResponseUrl.addQueryItem("method", fbRequestUrl.queryItemValue("method")); + fbResponseUrl.addQueryItem("nonce", fbRequestUrl.queryItemValue("nonce")); + fbResponseUrl.addQueryItem("access_token", credentialsData["AccessToken"].toString()); + fbResponseUrl.addQueryItem("api_key", credentialsData["ClientId"].toString()); + fbResponseUrl.addQueryItem("call_id", "0"); + fbResponseUrl.addQueryItem("v", "1.0"); + + //.mid(1) trims leading '?' char + kDebug() << fbResponseUrl.query().mid(1); + m_saslIface->Respond(fbResponseUrl.query().mid(1).toUtf8()); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/x-telepathy-sso-facebook-operation.h new/ktp-auth-handler-0.6.80/x-telepathy-sso-facebook-operation.h --- old/ktp-auth-handler-0.6.3/x-telepathy-sso-facebook-operation.h 1970-01-01 01:00:00.000000000 +0100 +++ new/ktp-auth-handler-0.6.80/x-telepathy-sso-facebook-operation.h 2013-09-23 23:15:41.000000000 +0200 @@ -0,0 +1,56 @@ +/* + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 2013 David Edmundson <[email protected]> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + + +#ifndef X_TELEPATHY_SSO_OPERATION_H +#define X_TELEPATHY_SSO_OPERATION_H + +#include <TelepathyQt/PendingOperation> +#include <TelepathyQt/Types> +#include <TelepathyQt/Channel> +#include <TelepathyQt/Account> + +class KJob; + +class XTelepathySSOFacebookOperation : public Tp::PendingOperation +{ + Q_OBJECT + Q_DISABLE_COPY(XTelepathySSOFacebookOperation) + +public: + explicit XTelepathySSOFacebookOperation( + const Tp::AccountPtr &account, + int accountStorageId, + Tp::Client::ChannelInterfaceSASLAuthenticationInterface *saslIface); + +private Q_SLOTS: + void onSASLStatusChanged(uint status, const QString &reason, const QVariantMap &details); + void onNewChallenge(const QByteArray &challengeData); + void gotCredentials(KJob *kjob); + +private: + Tp::AccountPtr m_account; + Tp::Client::ChannelInterfaceSASLAuthenticationInterface *m_saslIface; + + int m_accountStorageId; + QByteArray m_challengeData; + + friend class SaslAuthOp; +}; + +#endif // X_TELEPATHY_SSO_OPERATION_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/x-telepathy-sso-google-operation.cpp new/ktp-auth-handler-0.6.80/x-telepathy-sso-google-operation.cpp --- old/ktp-auth-handler-0.6.3/x-telepathy-sso-google-operation.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/ktp-auth-handler-0.6.80/x-telepathy-sso-google-operation.cpp 2013-09-23 23:15:41.000000000 +0200 @@ -0,0 +1,64 @@ +/************************************************************************************* + * Copyright (C) 2013 by Alejandro Fiestas Olivares <[email protected]> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser 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("\0", 1); + data.append(credentialsData["AccountUsername"].toByteArray()); + data.append("\0", 1); + data.append(credentialsData["AccessToken"].toByteArray()); + + m_saslIface->StartMechanismWithData(QLatin1String("X-OAUTH2"), data); +} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ktp-auth-handler-0.6.3/x-telepathy-sso-google-operation.h new/ktp-auth-handler-0.6.80/x-telepathy-sso-google-operation.h --- old/ktp-auth-handler-0.6.3/x-telepathy-sso-google-operation.h 1970-01-01 01:00:00.000000000 +0100 +++ new/ktp-auth-handler-0.6.80/x-telepathy-sso-google-operation.h 2013-09-23 23:15:41.000000000 +0200 @@ -0,0 +1,55 @@ +/************************************************************************************* + * Copyright (C) 2013 by Alejandro Fiestas Olivares <[email protected]> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser 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. * + *************************************************************************************/ + + +#ifndef X_TELEPATHY_SSO_GOOGLE_OPERATION_H +#define X_TELEPATHY_SSO_GOOGLE_OPERATION_H + +#include <TelepathyQt/PendingOperation> +#include <TelepathyQt/Channel> +#include <TelepathyQt/Account> + +class KJob; + +class XTelepathySSOGoogleOperation : public Tp::PendingOperation +{ + Q_OBJECT + Q_DISABLE_COPY(XTelepathySSOGoogleOperation) + +public: + explicit XTelepathySSOGoogleOperation( + const Tp::AccountPtr &account, + int accountStorageId, + Tp::Client::ChannelInterfaceSASLAuthenticationInterface *saslIface); + +private Q_SLOTS: + void onSASLStatusChanged(uint status, const QString &reason, const QVariantMap &details); + void gotCredentials(KJob *kjob); + +private: + Tp::AccountPtr m_account; + Tp::Client::ChannelInterfaceSASLAuthenticationInterface *m_saslIface; + + int m_accountStorageId;; + QByteArray m_challengeData; + + friend class SaslAuthOp; +}; + +#endif //X_TELEPATHY_SSO_GOOGLE_OPERATION_H -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
