signon  8.58
signonidentity.cpp
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) 2011 Intel Corporation.
6  * Copyright (C) 2013 Canonical Ltd.
7  *
8  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
9  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
10  * Contact: Jussi Laako <jussi.laako@linux.intel.com>
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * version 2.1 as published by the Free Software Foundation.
15  *
16  * This library is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24  * 02110-1301 USA
25  */
26 
27 #include <iostream>
28 #include <QVariantMap>
29 
30 #include "signond-common.h"
31 #include "signonidentity.h"
32 #include "signonui_interface.h"
33 #include "SignOn/uisessiondata.h"
34 #include "SignOn/uisessiondata_priv.h"
35 #include "signoncommon.h"
36 
38 #include "signonidentityadaptor.h"
39 
40 #define SIGNON_RETURN_IF_CAM_UNAVAILABLE(_ret_arg_) do { \
41  if (!(CredentialsAccessManager::instance()->credentialsSystemOpened())) { \
42  sendErrorReply(internalServerErrName, \
43  internalServerErrStr + \
44  QLatin1String("Could not access Signon Database."));\
45  return _ret_arg_; \
46  } \
47  } while(0)
48 
49 namespace SignonDaemonNS {
50 
51 const QString internalServerErrName = SIGNOND_INTERNAL_SERVER_ERR_NAME;
52 const QString internalServerErrStr = SIGNOND_INTERNAL_SERVER_ERR_STR;
53 
54 class PendingCallWatcherWithContext: public QDBusPendingCallWatcher
55 {
56  Q_OBJECT
57 
58 public:
59  PendingCallWatcherWithContext(const QDBusPendingCall &call,
60  SignonIdentity *parent):
61  QDBusPendingCallWatcher(call, parent),
62  m_connection(parent->connection()),
63  m_message(parent->message())
64  {
65  }
66 
67  PendingCallWatcherWithContext(const QDBusPendingCall &call,
68  const QDBusConnection &connection,
69  const QDBusMessage &message,
70  SignonIdentity *parent):
71  QDBusPendingCallWatcher(call, parent),
72  m_connection(connection),
73  m_message(message)
74  {
75  }
76 
77  const QDBusConnection &connection() const { return m_connection; }
78  const QDBusMessage &message() const { return m_message; }
79 
80 private:
81  QDBusConnection m_connection;
82  QDBusMessage m_message;
83 };
84 
85 SignonIdentity::SignonIdentity(quint32 id, int timeout,
86  SignonDaemon *parent):
87  SignonDisposable(timeout, parent),
88  m_pInfo(NULL)
89 {
90  m_id = id;
91 
92  (void)new SignonIdentityAdaptor(this);
93 
94  /*
95  * creation of unique name for the given identity
96  * */
97  static quint32 incr = 0;
98  QString objectName = SIGNOND_DAEMON_OBJECTPATH + QLatin1String("/Identity_")
99  + QString::number(incr++, 16);
100  setObjectName(objectName);
101 
102  m_signonui = new SignonUiAdaptor(SIGNON_UI_SERVICE,
104  QDBusConnection::sessionBus(),
105  this);
106 
107  /* Watch for credential updates happening outside of this object (this can
108  * happen on request of authentication plugins) */
109  CredentialsDB *db = CredentialsAccessManager::instance()->credentialsDB();
110  QObject::connect(db, SIGNAL(credentialsUpdated(quint32)),
111  this, SLOT(onCredentialsUpdated(quint32)));
112 }
113 
114 SignonIdentity::~SignonIdentity()
115 {
116  emit unregistered();
117 
118  delete m_signonui;
119  delete m_pInfo;
120 }
121 
123 {
124  return new SignonIdentity(id, parent->identityTimeout(), parent);
125 }
126 
128 {
129  /* Emitting the destroyed signal makes QDBusConnection unregister the
130  * object */
131  Q_EMIT destroyed();
132  deleteLater();
133 }
134 
135 SignonIdentityInfo SignonIdentity::queryInfo(bool &ok, bool queryPassword)
136 {
137  ok = true;
138 
139  bool needLoadFromDB = true;
140  if (m_pInfo) {
141  needLoadFromDB = false;
142  if (queryPassword && m_pInfo->password().isEmpty()) {
143  needLoadFromDB = true;
144  }
145  }
146 
147  if (needLoadFromDB) {
148  if (m_pInfo != 0) {
149  delete m_pInfo;
150  }
151 
152  CredentialsDB *db =
154  m_pInfo = new SignonIdentityInfo(db->credentials(m_id, queryPassword));
155 
156  if (db->lastError().isValid()) {
157  ok = false;
158  delete m_pInfo;
159  m_pInfo = NULL;
160  return SignonIdentityInfo();
161  }
162  }
163 
164  /* Make sure that we clear the password, if the caller doesn't need it */
165  SignonIdentityInfo info = *m_pInfo;
166  if (!queryPassword) {
167  info.setPassword(QString());
168  }
169  return info;
170 }
171 
172 bool SignonIdentity::addReference(const QString &reference)
173 {
174  TRACE() << "addReference: " << reference;
175 
177 
179  if (db == NULL) {
180  BLAME() << "NULL database handler object.";
181  return false;
182  }
183  const QDBusContext &context = static_cast<QDBusContext>(*this);
184  QString appId =
186  context.connection(),
187  context.message());
188  keepInUse();
189  return db->addReference(m_id, appId, reference);
190 }
191 
192 bool SignonIdentity::removeReference(const QString &reference)
193 {
194  TRACE() << "removeReference: " << reference;
195 
197 
199  if (db == NULL) {
200  BLAME() << "NULL database handler object.";
201  return false;
202  }
203  const QDBusContext &context = static_cast<QDBusContext>(*this);
204  QString appId =
206  context.connection(),
207  context.message());
208  keepInUse();
209  return db->removeReference(m_id, appId, reference);
210 }
211 
212 quint32 SignonIdentity::requestCredentialsUpdate(const QString &displayMessage)
213 {
214  SIGNON_RETURN_IF_CAM_UNAVAILABLE(SIGNOND_NEW_IDENTITY);
215 
216  bool ok;
217  SignonIdentityInfo info = queryInfo(ok, false);
218 
219  if (!ok) {
220  BLAME() << "Identity not found.";
221  sendErrorReply(SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME,
222  SIGNOND_IDENTITY_NOT_FOUND_ERR_STR);
223  return SIGNOND_NEW_IDENTITY;
224  }
225  if (!info.storePassword()) {
226  BLAME() << "Password cannot be stored.";
227  sendErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
228  SIGNOND_STORE_FAILED_ERR_STR);
229  return SIGNOND_NEW_IDENTITY;
230  }
231 
232  //delay dbus reply, ui interaction might take long time to complete
233  setDelayedReply(true);
234 
235  //create ui request to ask password
236  QVariantMap uiRequest;
237  uiRequest.insert(SSOUI_KEY_QUERYPASSWORD, true);
238  uiRequest.insert(SSOUI_KEY_USERNAME, info.userName());
239  uiRequest.insert(SSOUI_KEY_MESSAGE, displayMessage);
240  uiRequest.insert(SSOUI_KEY_CAPTION, info.caption());
241 
242  TRACE() << "Waiting for reply from signon-ui";
244  new PendingCallWatcherWithContext(m_signonui->queryDialog(uiRequest),
245  this);
246  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
247  this, SLOT(queryUiSlot(QDBusPendingCallWatcher*)));
248 
249  setAutoDestruct(false);
250  return 0;
251 }
252 
254 {
255  TRACE() << "QUERYING INFO";
256 
257  SIGNON_RETURN_IF_CAM_UNAVAILABLE(QVariantMap());
258 
259  bool ok;
260  SignonIdentityInfo info = queryInfo(ok, false);
261 
262  if (!ok) {
263  TRACE();
264  sendErrorReply(SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME,
265  SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR +
266  QLatin1String("Database querying error occurred."));
267  return QVariantMap();
268  }
269 
270  if (info.isNew()) {
271  TRACE();
272  sendErrorReply(SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME,
273  SIGNOND_IDENTITY_NOT_FOUND_ERR_STR);
274  return QVariantMap();
275  }
276 
277  keepInUse();
278  info.removeSecrets();
279  return info.toMap();
280 }
281 
282 void SignonIdentity::queryUserPassword(const QVariantMap &params,
283  const QDBusConnection &connection,
284  const QDBusMessage &message)
285 {
286  TRACE() << "Waiting for reply from signon-ui";
288  new PendingCallWatcherWithContext(m_signonui->queryDialog(params),
289  connection, message, this);
290  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this,
291  SLOT(verifyUiSlot(QDBusPendingCallWatcher*)));
292 
293  setAutoDestruct(false);
294 }
295 
296 bool SignonIdentity::verifyUser(const QVariantMap &params)
297 {
299 
300  bool ok;
301  SignonIdentityInfo info = queryInfo(ok, true);
302 
303  if (!ok) {
304  BLAME() << "Identity not found.";
305  sendErrorReply(SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME,
306  SIGNOND_IDENTITY_NOT_FOUND_ERR_STR);
307  return false;
308  }
309  if (!info.storePassword() || info.password().isEmpty()) {
310  BLAME() << "Password is not stored.";
311  sendErrorReply(SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME,
312  SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR);
313  return false;
314  }
315 
316  //delay dbus reply, ui interaction might take long time to complete
317  setDelayedReply(true);
318 
319  //create ui request to ask password
320  QVariantMap uiRequest;
321  uiRequest.unite(params);
322  uiRequest.insert(SSOUI_KEY_QUERYPASSWORD, true);
323  uiRequest.insert(SSOUI_KEY_USERNAME, info.userName());
324  uiRequest.insert(SSOUI_KEY_CAPTION, info.caption());
325 
326  queryUserPassword(uiRequest, connection(), message());
327  return false;
328 }
329 
330 bool SignonIdentity::verifySecret(const QString &secret)
331 {
333 
334  bool ok;
335  queryInfo(ok);
336  if (!ok) {
337  TRACE();
338  sendErrorReply(SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME,
339  SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR +
340  QLatin1String("Database querying error occurred."));
341  return false;
342  }
343 
345  bool ret = db->checkPassword(m_pInfo->id(), m_pInfo->userName(), secret);
346 
347  keepInUse();
348  return ret;
349 }
350 
352 {
354 
356  if ((db == 0) || !db->removeCredentials(m_id)) {
357  TRACE() << "Error occurred while inserting/updating credentials.";
358  sendErrorReply(SIGNOND_REMOVE_FAILED_ERR_NAME,
359  SIGNOND_REMOVE_FAILED_ERR_STR +
360  QLatin1String("Database error occurred."));
361  return;
362  }
363  setDelayedReply(true);
364  setAutoDestruct(false);
367  this);
368  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
369  this, SLOT(removeCompleted(QDBusPendingCallWatcher*)));
370  keepInUse();
371 }
372 
373 void SignonIdentity::removeCompleted(QDBusPendingCallWatcher *call)
374 {
375  Q_ASSERT(call != NULL);
376 
377  setAutoDestruct(true);
378  call->deleteLater();
379 
381  qobject_cast<PendingCallWatcherWithContext*>(call);
382  QDBusPendingReply<> signOnUiReply = *call;
383  bool ok = !signOnUiReply.isError();
384  TRACE() << (ok ? "removeIdentityData succeeded" : "removeIdentityData failed");
385 
386  emit infoUpdated((int)SignOn::IdentityRemoved);
387 
388  QDBusMessage reply = context->message().createReply();
389  context->connection().send(reply);
390 }
391 
393 {
394  TRACE() << "Signout request. Identity ID: " << id();
395  /*
396  * - If the identity is stored (thus registered here)
397  * signal 'sign out' to all identities subsribed to this object,
398  * otherwise the only identity subscribed to this is the newly
399  * created client side identity, which called this method.
400  * - This is just a safety check, as the client identity - if it is a new
401  * one - should not inform server side to sign out.
402  */
403  if (id() != SIGNOND_NEW_IDENTITY) {
404  //clear stored sessiondata
405  CredentialsDB *db =
407  if ((db == 0) || !db->removeData(m_id)) {
408  TRACE() << "clear data failed";
409  }
410 
411  setDelayedReply(true);
412  setAutoDestruct(false);
415  this);
416  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
417  this, SLOT(signOutCompleted(QDBusPendingCallWatcher*)));
418  }
419  keepInUse();
420  return true;
421 }
422 
423 void SignonIdentity::signOutCompleted(QDBusPendingCallWatcher *call)
424 {
425  Q_ASSERT(call != NULL);
426 
427  setAutoDestruct(true);
428  call->deleteLater();
429 
431  qobject_cast<PendingCallWatcherWithContext*>(call);
432  QDBusPendingReply<> signOnUiReply = *call;
433  bool ok = !signOnUiReply.isError();
434  TRACE() << (ok ? "removeIdentityData succeeded" : "removeIdentityData failed");
435 
436  emit infoUpdated((int)SignOn::IdentitySignedOut);
437 
438  QDBusMessage reply = context->message().createReply();
439  reply << ok;
440  context->connection().send(reply);
441 }
442 
443 void SignonIdentity::onCredentialsUpdated(quint32 id)
444 {
445  if (id != m_id) return;
446 
447  TRACE() << m_id;
448 
449  /* Clear the cached information about the identity; some of it might not be
450  * valid anymore */
451  if (m_pInfo) {
452  delete m_pInfo;
453  m_pInfo = NULL;
454  }
455 
456  emit infoUpdated((int)SignOn::IdentityDataUpdated);
457 }
458 
459 quint32 SignonIdentity::store(const QVariantMap &info)
460 {
461  keepInUse();
462  SIGNON_RETURN_IF_CAM_UNAVAILABLE(SIGNOND_NEW_IDENTITY);
463 
464  const QDBusContext &context = static_cast<QDBusContext>(*this);
465  QString appId =
467  context.connection(),
468  context.message());
469 
470  const QVariant container = info.value(SIGNOND_IDENTITY_INFO_AUTHMETHODS);
471  MethodMap methods = container.isValid() ?
472  qdbus_cast<MethodMap>(container.value<QDBusArgument>()) : MethodMap();
473 
474  if (m_pInfo == 0) {
475  m_pInfo = new SignonIdentityInfo(info);
476  m_pInfo->setMethods(methods);
477  //Add creator to owner list if it has AID
478  QStringList ownerList =
479  info.value(SIGNOND_IDENTITY_INFO_OWNER).toStringList();
480  if (!appId.isNull()) {
481  ownerList.append(appId);
482  }
483  m_pInfo->setOwnerList(ownerList);
484  } else {
485  SignonIdentityInfo newInfo(info);
486  m_pInfo->update(newInfo);
487  }
488 
489  m_id = storeCredentials(*m_pInfo);
490 
491  if (m_id == SIGNOND_NEW_IDENTITY) {
492  sendErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
493  SIGNOND_STORE_FAILED_ERR_STR);
494  }
495 
496  return m_id;
497 }
498 
500 {
502  if (db == NULL) {
503  BLAME() << "NULL database handler object.";
504  return SIGNOND_NEW_IDENTITY;
505  }
506 
507  bool newIdentity = info.isNew();
508 
509  if (newIdentity)
510  m_id = db->insertCredentials(info);
511  else
512  db->updateCredentials(info);
513 
514  if (db->errorOccurred()) {
515  if (newIdentity)
516  m_id = SIGNOND_NEW_IDENTITY;
517 
518  TRACE() << "Error occurred while inserting/updating credentials.";
519  } else {
520  if (m_pInfo) {
521  delete m_pInfo;
522  m_pInfo = NULL;
523  }
524  Q_EMIT stored(this);
525 
526  TRACE() << "FRESH, JUST STORED CREDENTIALS ID:" << m_id;
527  emit infoUpdated((int)SignOn::IdentityDataUpdated);
528  }
529  return m_id;
530 }
531 
532 void SignonIdentity::queryUiSlot(QDBusPendingCallWatcher *call)
533 {
534  TRACE();
535  Q_ASSERT(call != NULL);
536 
537  setAutoDestruct(true);
538 
540  qobject_cast<PendingCallWatcherWithContext*>(call);
541  const QDBusMessage &message = context->message();
542  const QDBusConnection &connection = context->connection();
543 
544  QDBusMessage errReply;
545  QDBusPendingReply<QVariantMap> reply = *call;
546  call->deleteLater();
547 
548  QVariantMap resultParameters;
549  if (!reply.isError() && reply.count()) {
550  resultParameters = reply.argumentAt<0>();
551  } else {
552  errReply = message.createErrorReply(
553  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
554  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
555  connection.send(errReply);
556  return;
557  }
558 
559  if (!resultParameters.contains(SSOUI_KEY_ERROR)) {
560  //no reply code
561  errReply = message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
562  SIGNOND_INTERNAL_SERVER_ERR_STR);
563  connection.send(errReply);
564  return;
565  }
566 
567  int errorCode = resultParameters.value(SSOUI_KEY_ERROR).toInt();
568  TRACE() << "error: " << errorCode;
569  if (errorCode != QUERY_ERROR_NONE) {
570  if (errorCode == QUERY_ERROR_CANCELED)
571  errReply =
572  message.createErrorReply(
573  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
574  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
575  else
576  errReply =
577  message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
578  QString(QLatin1String("signon-ui call returned error %1")).
579  arg(errorCode));
580 
581  connection.send(errReply);
582  return;
583  }
584 
585  if (resultParameters.contains(SSOUI_KEY_PASSWORD)) {
586  CredentialsDB *db =
588  if (db == NULL) {
589  BLAME() << "NULL database handler object.";
590  errReply = message.createErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
591  SIGNOND_STORE_FAILED_ERR_STR);
592  connection.send(errReply);
593  return;
594  }
595 
596  //store new password
597  if (m_pInfo) {
598  m_pInfo->setPassword(resultParameters[SSOUI_KEY_PASSWORD].toString());
599 
600  quint32 ret = db->updateCredentials(*m_pInfo);
601  delete m_pInfo;
602  m_pInfo = NULL;
603  if (ret != SIGNOND_NEW_IDENTITY) {
604  QDBusMessage dbusreply = message.createReply();
605  dbusreply << quint32(m_id);
606  connection.send(dbusreply);
607  return;
608  } else{
609  BLAME() << "Error during update";
610  }
611  }
612  }
613 
614  //this should not happen, return error
615  errReply = message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
616  SIGNOND_INTERNAL_SERVER_ERR_STR);
617  connection.send(errReply);
618  return;
619 }
620 
621 void SignonIdentity::verifyUiSlot(QDBusPendingCallWatcher *call)
622 {
623  TRACE();
624  Q_ASSERT(call != NULL);
625 
626  setAutoDestruct(true);
627 
629  qobject_cast<PendingCallWatcherWithContext*>(call);
630  const QDBusMessage &message = context->message();
631  const QDBusConnection &connection = context->connection();
632 
633  QDBusMessage errReply;
634  QDBusPendingReply<QVariantMap> reply = *call;
635  call->deleteLater();
636  QVariantMap resultParameters;
637  if (!reply.isError() && reply.count()) {
638  resultParameters = reply.argumentAt<0>();
639  } else {
640  errReply =
641  message.createErrorReply(
642  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
643  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
644  connection.send(errReply);
645  return;
646  }
647 
648  if (!resultParameters.contains(SSOUI_KEY_ERROR)) {
649  //no reply code
650  errReply = message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
651  SIGNOND_INTERNAL_SERVER_ERR_STR);
652  connection.send(errReply);
653  return;
654  }
655 
656  int errorCode = resultParameters.value(SSOUI_KEY_ERROR).toInt();
657  TRACE() << "error: " << errorCode;
658  if (errorCode != QUERY_ERROR_NONE) {
659  if (errorCode == QUERY_ERROR_CANCELED)
660  errReply = message.createErrorReply(
661  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
662  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
663  else if (errorCode == QUERY_ERROR_FORGOT_PASSWORD)
664  errReply = message.createErrorReply(
665  SIGNOND_FORGOT_PASSWORD_ERR_NAME,
666  SIGNOND_FORGOT_PASSWORD_ERR_STR);
667  else
668  errReply = message.createErrorReply(
669  SIGNOND_INTERNAL_SERVER_ERR_NAME,
670  QString(QLatin1String("signon-ui call "
671  "returned error %1")).
672  arg(errorCode));
673 
674  connection.send(errReply);
675  return;
676  }
677 
678  if (resultParameters.contains(SSOUI_KEY_PASSWORD)) {
679  CredentialsDB *db =
681  if (db == NULL) {
682  BLAME() << "NULL database handler object.";
683  errReply = message.createErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
684  SIGNOND_STORE_FAILED_ERR_STR);
685  connection.send(errReply);
686  return;
687  }
688 
689  //compare passwords
690  if (m_pInfo) {
691  bool ret =
692  m_pInfo->password() == resultParameters[SSOUI_KEY_PASSWORD].
693  toString();
694 
695  if (!ret && resultParameters.contains(SSOUI_KEY_CONFIRMCOUNT)) {
696  int count = resultParameters[SSOUI_KEY_CONFIRMCOUNT].toInt();
697  TRACE() << "retry count:" << count;
698  if (count > 0) { //retry
699  resultParameters[SSOUI_KEY_CONFIRMCOUNT] = (count-1);
700  resultParameters[SSOUI_KEY_MESSAGEID] =
701  QUERY_MESSAGE_NOT_AUTHORIZED;
702  queryUserPassword(resultParameters, connection, message);
703  return;
704  } else {
705  //TODO show error note here if needed
706  }
707  }
708  delete m_pInfo;
709  m_pInfo = NULL;
710  QDBusMessage dbusreply = message.createReply();
711  dbusreply << ret;
712  connection.send(dbusreply);
713  return;
714  }
715  }
716  //this should not happen, return error
717  errReply = message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
718  SIGNOND_INTERNAL_SERVER_ERR_STR);
719  connection.send(errReply);
720  return;
721 }
722 
723 } //namespace SignonDaemonNS
724 
725 #include "signonidentity.moc"
bool removeData(const quint32 id, const QString &method=QString())
const QString internalServerErrName
#define SIGNON_RETURN_IF_CAM_UNAVAILABLE(_ret_arg_)
QString appIdOfPeer(const QDBusConnection &peerConnection, const QDBusMessage &peerMessage)
Looks up for the application identifier of a specific client process.
quint32 requestCredentialsUpdate(const QString &message)
#define BLAME()
Definition: debug.h:32
static AccessControlManagerHelper * instance()
bool addReference(const QString &reference)
void setMethods(const MethodMap &methods)
void destroy()
Performs any predestruction operations and the destruction itself.
void verifyUiSlot(QDBusPendingCallWatcher *call)
friend class PendingCallWatcherWithContext
quint32 insertCredentials(const SignonIdentityInfo &info)
quint32 updateCredentials(const SignonIdentityInfo &info)
SignOn::CredentialsDBError lastError() const
bool verifySecret(const QString &secret)
bool addReference(const quint32 id, const QString &token, const QString &reference)
bool verifyUser(const QVariantMap &params)
bool removeCredentials(const quint32 id)
static SignonIdentity * createIdentity(quint32 id, SignonDaemon *parent)
static CredentialsAccessManager * instance()
Returns CAM instance.
#define SIGNON_UI_SERVICE
void setPassword(const QString &password)
void queryUiSlot(QDBusPendingCallWatcher *call)
SignonIdentityInfo credentials(const quint32 id, bool queryPassword=true)
QDBusPendingCall queryDialog(const QVariantMap &parameters)
bool removeReference(const quint32 id, const QString &token, const QString &reference=QString())
const QString internalServerErrStr
QDBusPendingCall removeIdentityData(quint32 id)
QMap< MethodName, MechanismsList > MethodMap
quint32 store(const QVariantMap &info)
#define TRACE()
Definition: debug.h:28
bool removeReference(const QString &reference)
Daemon side representation of identity.
void stored(SignonIdentity *identity)
Daemon side representation of identity information.
bool checkPassword(const quint32 id, const QString &username, const QString &password)
Manages the credentials I/O.
Definition: credentialsdb.h:66
Helper class for access control-related functionality.
#define SIGNON_UI_DAEMON_OBJECTPATH
quint32 storeCredentials(const SignonIdentityInfo &info)
void setAutoDestruct(bool value=true) const
Mark the object as used.
SignonIdentityInfo queryInfo(bool &ok, bool queryPassword=true)
const QVariantMap toMap() const
void keepInUse() const
Mark the object as used.
int identityTimeout() const
Returns the number of seconds of inactivity after which identity objects might be automatically delet...
void update(const SignonIdentityInfo &info)
void setOwnerList(const QStringList &owners)