signon  8.42
signonidentity.h
Go to the documentation of this file.
1 /*
2  * This file is part of signon
3  *
4  * Copyright (C) 2009-2010 Nokia Corporation.
5  * Copyright (C) 2012 Canonical Ltd.
6  *
7  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
8  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public License
12  * version 2.1 as published by the Free Software Foundation.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23  */
24 
25 #ifndef SIGNONIDENTITY_H_
26 #define SIGNONIDENTITY_H_
27 
28 #include <QtCore>
29 #include <QtDBus>
30 
31 #include "pluginproxy.h"
32 
33 #include "signond-common.h"
34 #include "signondaemon.h"
35 #include "signondisposable.h"
36 #include "signonidentityinfo.h"
38 
39 #include "signonui_interface.h"
40 
41 namespace SignonDaemonNS {
42 
48 class SignonIdentity: public SignonDisposable, protected QDBusContext
49 {
50  Q_OBJECT
51 
52  friend class SignonIdentityAdaptor;
53 
54  virtual ~SignonIdentity();
55 
56 public:
57  void destroy();
58  static SignonIdentity *createIdentity(quint32 id, SignonDaemon *parent);
59  quint32 id() const { return m_id; }
60 
61  SignonIdentityInfo queryInfo(bool &ok, bool queryPassword = true);
62  quint32 storeCredentials(const SignonIdentityInfo &info);
63 
64 public Q_SLOTS:
65  quint32 requestCredentialsUpdate(const QString &message);
66  QVariantMap getInfo();
67  bool addReference(const QString &reference);
68  bool removeReference(const QString &reference);
69  bool verifyUser(const QVariantMap &params);
70  bool verifySecret(const QString &secret);
71  void remove();
72  bool signOut();
73  quint32 store(const QVariantMap &info);
74  void queryUiSlot(QDBusPendingCallWatcher *call);
75  void verifyUiSlot(QDBusPendingCallWatcher *call);
76 Q_SIGNALS:
77  void unregistered();
78  //TODO - split this into the 3 separate signals(updated, removed, signed out)
79  void infoUpdated(int);
80 
81 private:
82  SignonIdentity(quint32 id, int timeout, SignonDaemon *parent);
83  bool init();
84  bool credentialsStored() const { return m_id > 0 ? true : false; }
85  void queryUserPassword(const QVariantMap &params);
86 
87 private:
88  quint32 m_id;
89  SignonUiAdaptor *m_signonui;
90  SignonIdentityInfo *m_pInfo;
91  SignonDaemon *m_pSignonDaemon;
92  bool m_registered;
93  QDBusMessage m_message;
94 
95 }; //class SignonDaemon
96 
97 } //namespace SignonDaemonNS
98 
99 #endif /* SIGNONIDENTITY_H_ */