signon  8.58
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-2013 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 
43 class PendingCallWatcherWithContext;
44 
50 class SignonIdentity: public SignonDisposable, protected QDBusContext
51 {
52  Q_OBJECT
53 
55  friend class SignonIdentityAdaptor;
56 
57  virtual ~SignonIdentity();
58 
59 public:
60  void destroy();
61  static SignonIdentity *createIdentity(quint32 id, SignonDaemon *parent);
62  quint32 id() const { return m_id; }
63 
64  SignonIdentityInfo queryInfo(bool &ok, bool queryPassword = true);
65  quint32 storeCredentials(const SignonIdentityInfo &info);
66 
67 public Q_SLOTS:
68  quint32 requestCredentialsUpdate(const QString &message);
69  QVariantMap getInfo();
70  bool addReference(const QString &reference);
71  bool removeReference(const QString &reference);
72  bool verifyUser(const QVariantMap &params);
73  bool verifySecret(const QString &secret);
74  void remove();
75  bool signOut();
76  quint32 store(const QVariantMap &info);
77  void queryUiSlot(QDBusPendingCallWatcher *call);
78  void verifyUiSlot(QDBusPendingCallWatcher *call);
79 Q_SIGNALS:
80  void unregistered();
81  //TODO - split this into the 3 separate signals(updated, removed, signed out)
82  void infoUpdated(int);
83  void stored(SignonIdentity *identity);
84 
85 private Q_SLOTS:
86  void removeCompleted(QDBusPendingCallWatcher *call);
87  void signOutCompleted(QDBusPendingCallWatcher *call);
88  void onCredentialsUpdated(quint32 id);
89 
90 private:
91  SignonIdentity(quint32 id, int timeout, SignonDaemon *parent);
92  void queryUserPassword(const QVariantMap &params,
93  const QDBusConnection &connection,
94  const QDBusMessage &message);
95 
96 private:
97  quint32 m_id;
98  SignonUiAdaptor *m_signonui;
99  SignonIdentityInfo *m_pInfo;
100 }; //class SignonDaemon
101 
102 } //namespace SignonDaemonNS
103 
104 #endif /* SIGNONIDENTITY_H_ */
Base class for server objects that can be automatically destroyed after a certain period of inactivit...
quint32 requestCredentialsUpdate(const QString &message)
bool addReference(const QString &reference)
void destroy()
Performs any predestruction operations and the destruction itself.
void verifyUiSlot(QDBusPendingCallWatcher *call)
friend class PendingCallWatcherWithContext
bool verifySecret(const QString &secret)
bool verifyUser(const QVariantMap &params)
static SignonIdentity * createIdentity(quint32 id, SignonDaemon *parent)
void queryUiSlot(QDBusPendingCallWatcher *call)
quint32 store(const QVariantMap &info)
Definition of the CredentialsAccessManager object.
bool removeReference(const QString &reference)
Daemon side representation of identity.
void stored(SignonIdentity *identity)
Daemon side representation of identity information.
quint32 storeCredentials(const SignonIdentityInfo &info)
SignonIdentityInfo queryInfo(bool &ok, bool queryPassword=true)