Hi, Here are 3 patches.
1.The most important is the AuthSession::signedOut() signal, Signon Qt lib implementation, so that we have the API updated (still need to add it to the glib part). -- (Patch 2)
2.The deprecated errors enum defs are removed from the client API code -- (Patch 1)
3. The authentication core cache is not clearing data at signon session destruction or when the clear() method is called -- (Patch 3)
Br, Aurel
>From 4dc315fc9491109810f9979aad999c1b996acb1b Mon Sep 17 00:00:00 2001 From: Aurel Popirtac <[email protected]> Date: Fri, 6 May 2011 12:05:04 +0300 Subject: [PATCH 1/3] Removed deprecated error enums. --- lib/SignOn/authservice.h | 16 ---------------- lib/SignOn/authsession.h | 25 ------------------------- lib/SignOn/identity.h | 21 --------------------- src/example/signonclient.cpp | 6 +++--- tests/libsignon-qt-tests/ssotestclient.h | 4 ---- tests/signond-tests/timeouts.cpp | 15 ++++++--------- tests/signond-tests/timeouts.h | 2 +- 7 files changed, 10 insertions(+), 79 deletions(-) diff --git a/lib/SignOn/authservice.h b/lib/SignOn/authservice.h index b951f80..2c832f1 100644 --- a/lib/SignOn/authservice.h +++ b/lib/SignOn/authservice.h @@ -55,22 +55,6 @@ namespace SignOn { public: /*! - * @enum ServiceError - * Codes for errors that may be reported by AuthService objects. - * @deprecated This enum is deprecated. Replaced by Error::ErrorType. - */ - enum ServiceError { - UnknownError = 1, /**< Catch-all for errors not distinguished by another code. */ - InternalServerError = 2, /**< Signon Daemon internal error. */ - InternalCommunicationError = 3, /**< Communication with Signon Daemon error. */ - PermissionDeniedError = 4, /**< The operation cannot be performed due to insufficient client permissions. */ - AuthServiceErr = 100, /* Placeholder to rearrange enumeration */ - MethodNotKnownError, /**< The method with this name is not found. */ - NotAvailableError, /**< The service is temporarily unavailable. */ - InvalidQueryError /**< Parameters for the query are invalid. */ - }; - - /*! * @enum IdentityFilterCriteria * Criterias for idetity query filtering. * @see AuthService::queryIdentities() diff --git a/lib/SignOn/authsession.h b/lib/SignOn/authsession.h index 156cf7e..b0a9b4e 100644 --- a/lib/SignOn/authsession.h +++ b/lib/SignOn/authsession.h @@ -58,31 +58,6 @@ namespace SignOn { public: /*! - * @enum AuthSessionError - * Codes for errors that may be reported by AuthSession objects - * @deprecated This enum is deprecated. Replaced by Error::ErrorType. - */ - enum AuthSessionError { - UnknownError = 1, /**< Catch-all for errors not distinguished by another code. */ - InternalServerError = 2, /**< Signon Daemon internal error. */ - InternalCommunicationError = 3, /**< Communication with Signon Daemon error . */ - PermissionDeniedError = 4, /**< The operation cannot be performed due to insufficient client permissions. */ - AuthSessionErr = 300, /* placeholder to rearrange enumeration */ - MechanismNotAvailableError, /**< The requested mechanism is not available. */ - MissingDataError, /**< The SessionData object does not contain necessary information. */ - InvalidCredentialsError, /**< The supplied credentials are invalid for the mechanism implementation. */ - WrongStateError, /**< An operation method has been called in a wrong state. */ - OperationNotSupportedError, /**< The operation is not supported by the mechanism implementation. */ - NoConnectionError, /**< No Network connetion. */ - NetworkError, /**< Network connetion failed. */ - SslError, /**< Ssl connetion failed. */ - RuntimeError, /**< Casting SessionData into subclass failed */ - CanceledError, /**< Challenge was canceled. */ - TimedOutError, /**< Challenge was timed out. */ - UserInteractionError /**< User interaction dialog failed */ - }; - - /*! * @enum AuthSessionState * Codes for the states of the AuthSession object. * @see stateChanged(AuthSession::AuthSessionState state, const QString &message) diff --git a/lib/SignOn/identity.h b/lib/SignOn/identity.h index 5a71648..e477a94 100644 --- a/lib/SignOn/identity.h +++ b/lib/SignOn/identity.h @@ -61,27 +61,6 @@ namespace SignOn { friend class IdentityImpl; - public: - /*! - * @enum IdentityError - * Codes for errors that may be reported by Identity objects - * @deprecated This enum is deprecated. Replaced by Error::ErrorType. - */ - enum IdentityError { - UnknownError = 1, /**< Catch-all for errors not distinguished by another code. */ - InternalServerError = 2, /**< Signon Daemon internal error. */ - InternalCommunicationError = 3, /**< Communication with Signon Daemon error . */ - PermissionDeniedError = 4, /**< The operation cannot be performed due to insufficient client permissions. */ - IdentityErr = 200, /* placeholder to rearrange enumeration */ - MethodNotAvailableError, /**< The requested mechanism is not available. */ - NotFoundError, /**< The identity matching this Identity object was not found on the service. */ - StoreFailedError, /**< Storing credentials failed. */ - RemoveFailedError, /**< Removing credentials failed. */ - SignOutFailedError, /**< SignOut failed. */ - CanceledError, /**< Operation was canceled by user. */ - CredentialsNotAvailableError /** Query fails*/ - }; - protected: /*! * @internal diff --git a/src/example/signonclient.cpp b/src/example/signonclient.cpp index 0e5dc56..7b867e4 100644 --- a/src/example/signonclient.cpp +++ b/src/example/signonclient.cpp @@ -182,7 +182,7 @@ void SignonClient::on_challenge_clicked() { qDebug("on_challenge_clicked"); if (!m_identity) { - error(Error(SignOn::Identity::CanceledError, + error(Error(Error::IdentityNotFound, QLatin1String("Identity not created"))); return; } @@ -220,7 +220,7 @@ void SignonClient::on_google_clicked() { qDebug("on_google_clicked"); if (!m_identity) { - error(Error(SignOn::Identity::CanceledError, + error(Error(Error::IdentityNotFound, QLatin1String("Identity not created"))); return; } @@ -246,7 +246,7 @@ void SignonClient::on_verify_clicked() { qDebug("on_verify_clicked"); if (!m_identity) { - error(Error(SignOn::Identity::CanceledError, + error(Error(Error::IdentityNotFound, QLatin1String("Identity not created"))); return; } diff --git a/tests/libsignon-qt-tests/ssotestclient.h b/tests/libsignon-qt-tests/ssotestclient.h index 36ba96d..ba03661 100644 --- a/tests/libsignon-qt-tests/ssotestclient.h +++ b/tests/libsignon-qt-tests/ssotestclient.h @@ -114,10 +114,6 @@ private: /* * Helpers * */ - //deprecated - static QString authErrCodeAsStr(const AuthService::ServiceError); - //deprecated - static QString idErrCodeAsStr(const Identity::IdentityError); static QString errCodeAsStr(const Error::ErrorType); bool storeCredentialsPrivate(const SignOn::IdentityInfo &info); diff --git a/tests/signond-tests/timeouts.cpp b/tests/signond-tests/timeouts.cpp index 75e6eb5..4611742 100644 --- a/tests/signond-tests/timeouts.cpp +++ b/tests/signond-tests/timeouts.cpp @@ -86,9 +86,9 @@ void TimeoutsTest::identityTimeout() this, SLOT(credentialsStored(const quint32))); QObject::connect(identity, - SIGNAL(error(Identity::IdentityError,const QString&)), + SIGNAL(error(const SignOn::Error &)), this, - SLOT(identityError(Identity::IdentityError,const QString&))); + SLOT(error(const SignOn::Error &))); identity->storeCredentials(); @@ -150,9 +150,9 @@ void TimeoutsTest::identityRegisterTwice() this, SLOT(credentialsStored(const quint32))); QObject::connect(identity, - SIGNAL(error(Identity::IdentityError,const QString&)), + SIGNAL(error(const SignOn::Error &)), this, - SLOT(identityError(Identity::IdentityError,const QString&))); + SLOT(error(const SignOn::Error &))); identity->storeCredentials(); @@ -205,14 +205,11 @@ void TimeoutsTest::identityRegisterTwice() QVERIFY(identityAlive(path)); } -void TimeoutsTest::identityError(Identity::IdentityError code, - const QString &message) +void TimeoutsTest::identityError(const SignOn::Error &error) { - qDebug() << Q_FUNC_INFO << message; + qDebug() << Q_FUNC_INFO << error.message(); QFAIL("Unexpected error!"); emit finished(); - - Q_UNUSED(code); } bool TimeoutsTest::triggerDisposableCleanup() diff --git a/tests/signond-tests/timeouts.h b/tests/signond-tests/timeouts.h index 607e9d5..f01eb48 100644 --- a/tests/signond-tests/timeouts.h +++ b/tests/signond-tests/timeouts.h @@ -36,7 +36,7 @@ class TimeoutsTest: public QObject public Q_SLOTS: void credentialsStored(const quint32 id); - void identityError(Identity::IdentityError code, const QString &message); + void identityError(const SignOn::Error &error); #if defined(SSO_CI_TESTMANAGEMENT) void runAllTests(); -- 1.6.3.3
>From dda10c2cb4597ccd0548ce1f40063ff2031a37da Mon Sep 17 00:00:00 2001 From: Aurel Popirtac <[email protected]> Date: Fri, 6 May 2011 12:06:21 +0300 Subject: [PATCH 2/3] libsignon-qt session signed out signal. --- lib/SignOn/authsession.h | 7 +++++++ lib/SignOn/authsessionimpl.cpp | 9 +++++++++ lib/SignOn/authsessionimpl.h | 1 + 3 files changed, 17 insertions(+), 0 deletions(-) diff --git a/lib/SignOn/authsession.h b/lib/SignOn/authsession.h index b0a9b4e..ce56543 100644 --- a/lib/SignOn/authsession.h +++ b/lib/SignOn/authsession.h @@ -238,6 +238,13 @@ namespace SignOn { */ void stateChanged(AuthSession::AuthSessionState state, const QString &message); + /*! + * Signals the fact that the session was signed out. + * All clients using this authentication session should close any opened + * server session upon receiving this signal. + */ + void signedOut(); + private: class AuthSessionImpl *impl; }; diff --git a/lib/SignOn/authsessionimpl.cpp b/lib/SignOn/authsessionimpl.cpp index 5e984d5..a0c2afb 100644 --- a/lib/SignOn/authsessionimpl.cpp +++ b/lib/SignOn/authsessionimpl.cpp @@ -431,6 +431,9 @@ void AuthSessionImpl::authenticationSlot(const QString &path) connect(m_DBusInterface, SIGNAL(unregistered()), this, SLOT(unregisteredSlot())); + connect(m_DBusInterface, SIGNAL(signedOut()), + SLOT(signedOutSlot())); + if (m_operationQueueHandler.queuedOperationsCount() > 0) m_operationQueueHandler.execQueuedOperations(); } else { @@ -484,3 +487,9 @@ void AuthSessionImpl::unregisteredSlot() m_isAuthInProcessing = false; m_isValid = true; } + +void AuthSessionImpl::signedOutSlot() +{ + //Keep this slot if additional handling is required + emit m_parent->signedOut(); +} diff --git a/lib/SignOn/authsessionimpl.h b/lib/SignOn/authsessionimpl.h index 928ae73..6766dc5 100644 --- a/lib/SignOn/authsessionimpl.h +++ b/lib/SignOn/authsessionimpl.h @@ -71,6 +71,7 @@ namespace SignOn { void responseSlot(const QVariantMap &sessionDataVa); void stateSlot(int state, const QString &message); void unregisteredSlot(); + void signedOutSlot(); private: void send2interface(const QString &operation, const char *slot, const QVariantList &arguments); -- 1.6.3.3
>From 423f722c51fa382497c7a72b74cbbbb53b8b7efc Mon Sep 17 00:00:00 2001 From: Aurel Popirtac <[email protected]> Date: Fri, 6 May 2011 12:06:49 +0300 Subject: [PATCH 3/3] AuthCoreCache clearing skipped. --- src/signond/signonsessioncoretools.cpp | 8 ++++++++ src/signond/signonsessioncoretools.h | 3 +++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/src/signond/signonsessioncoretools.cpp b/src/signond/signonsessioncoretools.cpp index 1804e83..f4f8508 100644 --- a/src/signond/signonsessioncoretools.cpp +++ b/src/signond/signonsessioncoretools.cpp @@ -92,6 +92,7 @@ RequestData::~RequestData() AuthCoreCache *AuthCoreCache::m_instance = 0; AuthCoreCache::AuthCache::AuthCache() + : internalClearRequest(false) {} AuthCoreCache::AuthCache::~AuthCache() @@ -108,6 +109,7 @@ AuthCoreCache::AuthCoreCache(QObject *parent) : QObject(parent) AuthCoreCache::~AuthCoreCache() { + internalClearRequest = true; clear(); m_instance = 0; } @@ -158,6 +160,9 @@ void AuthCoreCache::insert(const CacheId &id, AuthCache *cache) void AuthCoreCache::authSessionDestroyed(const CacheId &id) { + //Do not clear the cache until the secure storage will have been stabilized. + return; + AuthCache *data = m_cache.value(id.first, 0); if (data != 0) { AuthMethods authMethods = m_cachingSessionsMethods[id.first]; @@ -171,6 +176,9 @@ void AuthCoreCache::authSessionDestroyed(const CacheId &id) void AuthCoreCache::clear() { + //Do not clear the cache until the secure storage will have been stabilized. + if (!internalClearRequest) return; + QList<IdentityId> keys = m_cache.keys(); foreach (IdentityId key, keys) delete m_cache.take(key); diff --git a/src/signond/signonsessioncoretools.h b/src/signond/signonsessioncoretools.h index 8846ffa..580f58b 100644 --- a/src/signond/signonsessioncoretools.h +++ b/src/signond/signonsessioncoretools.h @@ -143,6 +143,8 @@ public: AuthCache *data(const IdentityId id) const; void insert(const CacheId &id, AuthCache *cache); + bool isEmpty() const { return size() == 0; } + int size() const { return m_cache.size(); } void clear(); void authSessionDestroyed(const CacheId &id); @@ -150,6 +152,7 @@ public: private: QHash<IdentityId, AuthCache *> m_cache; QHash<IdentityId, AuthMethods> m_cachingSessionsMethods; + bool internalClearRequest; }; typedef AuthCoreCache::AuthCache AuthCache; -- 1.6.3.3
_______________________________________________ MeeGo-dev mailing list [email protected] http://lists.meego.com/listinfo/meego-dev http://wiki.meego.com/Mailing_list_guidelines
