signon  8.58
signonidentity.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of signon
00003  *
00004  * Copyright (C) 2009-2010 Nokia Corporation.
00005  * Copyright (C) 2012-2013 Canonical Ltd.
00006  *
00007  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
00008  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public License
00012  * version 2.1 as published by the Free Software Foundation.
00013  *
00014  * This library is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00022  * 02110-1301 USA
00023  */
00024 
00025 #ifndef SIGNONIDENTITY_H_
00026 #define SIGNONIDENTITY_H_
00027 
00028 #include <QtCore>
00029 #include <QtDBus>
00030 
00031 #include "pluginproxy.h"
00032 
00033 #include "signond-common.h"
00034 #include "signondaemon.h"
00035 #include "signondisposable.h"
00036 #include "signonidentityinfo.h"
00037 #include "credentialsaccessmanager.h"
00038 
00039 #include "signonui_interface.h"
00040 
00041 namespace SignonDaemonNS {
00042 
00043 class PendingCallWatcherWithContext;
00044 
00050 class SignonIdentity: public SignonDisposable, protected QDBusContext
00051 {
00052     Q_OBJECT
00053 
00054     friend class PendingCallWatcherWithContext;
00055     friend class SignonIdentityAdaptor;
00056 
00057     virtual ~SignonIdentity();
00058 
00059 public:
00060     void destroy();
00061     static SignonIdentity *createIdentity(quint32 id, SignonDaemon *parent);
00062     quint32 id() const { return m_id; }
00063 
00064     SignonIdentityInfo queryInfo(bool &ok, bool queryPassword = true);
00065     quint32 storeCredentials(const SignonIdentityInfo &info);
00066 
00067 public Q_SLOTS:
00068     quint32 requestCredentialsUpdate(const QString &message);
00069     QVariantMap getInfo();
00070     bool addReference(const QString &reference);
00071     bool removeReference(const QString &reference);
00072     bool verifyUser(const QVariantMap &params);
00073     bool verifySecret(const QString &secret);
00074     void remove();
00075     bool signOut();
00076     quint32 store(const QVariantMap &info);
00077     void queryUiSlot(QDBusPendingCallWatcher *call);
00078     void verifyUiSlot(QDBusPendingCallWatcher *call);
00079 Q_SIGNALS:
00080     void unregistered();
00081     //TODO - split this into the 3 separate signals(updated, removed, signed out)
00082     void infoUpdated(int);
00083     void stored(SignonIdentity *identity);
00084 
00085 private Q_SLOTS:
00086     void removeCompleted(QDBusPendingCallWatcher *call);
00087     void signOutCompleted(QDBusPendingCallWatcher *call);
00088     void onCredentialsUpdated(quint32 id);
00089 
00090 private:
00091     SignonIdentity(quint32 id, int timeout, SignonDaemon *parent);
00092     void queryUserPassword(const QVariantMap &params,
00093                            const QDBusConnection &connection,
00094                            const QDBusMessage &message);
00095 
00096 private:
00097     quint32 m_id;
00098     SignonUiAdaptor *m_signonui;
00099     SignonIdentityInfo *m_pInfo;
00100 }; //class SignonDaemon
00101 
00102 } //namespace SignonDaemonNS
00103 
00104 #endif /* SIGNONIDENTITY_H_ */