signon  8.56
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 
108 SignonIdentity::~SignonIdentity()
109 {
110  emit unregistered();
111 
112  delete m_signonui;
113  delete m_pInfo;
114 }
115 
117 {
118  return new SignonIdentity(id, parent->identityTimeout(), parent);
119 }
120 
122 {
123  /* Emitting the destroyed signal makes QDBusConnection unregister the
124  * object */
125  Q_EMIT destroyed();
126  deleteLater();
127 }
128 
129 SignonIdentityInfo SignonIdentity::queryInfo(bool &ok, bool queryPassword)
130 {
131  ok = true;
132 
133  bool needLoadFromDB = true;
134  if (m_pInfo) {
135  needLoadFromDB = false;
136  if (queryPassword && m_pInfo->password().isEmpty()) {
137  needLoadFromDB = true;
138  }
139  }
140 
141  if (needLoadFromDB) {
142  if (m_pInfo != 0) {
143  delete m_pInfo;
144  }
145 
146  CredentialsDB *db =
148  m_pInfo = new SignonIdentityInfo(db->credentials(m_id, queryPassword));
149 
150  if (db->lastError().isValid()) {
151  ok = false;
152  delete m_pInfo;
153  m_pInfo = NULL;
154  return SignonIdentityInfo();
155  }
156  }
157 
158  /* Make sure that we clear the password, if the caller doesn't need it */
159  SignonIdentityInfo info = *m_pInfo;
160  if (!queryPassword) {
161  info.setPassword(QString());
162  }
163  return info;
164 }
165 
166 bool SignonIdentity::addReference(const QString &reference)
167 {
168  TRACE() << "addReference: " << reference;
169 
171 
173  if (db == NULL) {
174  BLAME() << "NULL database handler object.";
175  return false;
176  }
177  const QDBusContext &context = static_cast<QDBusContext>(*this);
178  QString appId =
180  context.connection(),
181  context.message());
182  keepInUse();
183  return db->addReference(m_id, appId, reference);
184 }
185 
186 bool SignonIdentity::removeReference(const QString &reference)
187 {
188  TRACE() << "removeReference: " << reference;
189 
191 
193  if (db == NULL) {
194  BLAME() << "NULL database handler object.";
195  return false;
196  }
197  const QDBusContext &context = static_cast<QDBusContext>(*this);
198  QString appId =
200  context.connection(),
201  context.message());
202  keepInUse();
203  return db->removeReference(m_id, appId, reference);
204 }
205 
206 quint32 SignonIdentity::requestCredentialsUpdate(const QString &displayMessage)
207 {
208  SIGNON_RETURN_IF_CAM_UNAVAILABLE(SIGNOND_NEW_IDENTITY);
209 
210  bool ok;
211  SignonIdentityInfo info = queryInfo(ok, false);
212 
213  if (!ok) {
214  BLAME() << "Identity not found.";
215  sendErrorReply(SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME,
216  SIGNOND_IDENTITY_NOT_FOUND_ERR_STR);
217  return SIGNOND_NEW_IDENTITY;
218  }
219  if (!info.storePassword()) {
220  BLAME() << "Password cannot be stored.";
221  sendErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
222  SIGNOND_STORE_FAILED_ERR_STR);
223  return SIGNOND_NEW_IDENTITY;
224  }
225 
226  //delay dbus reply, ui interaction might take long time to complete
227  setDelayedReply(true);
228 
229  //create ui request to ask password
230  QVariantMap uiRequest;
231  uiRequest.insert(SSOUI_KEY_QUERYPASSWORD, true);
232  uiRequest.insert(SSOUI_KEY_USERNAME, info.userName());
233  uiRequest.insert(SSOUI_KEY_MESSAGE, displayMessage);
234  uiRequest.insert(SSOUI_KEY_CAPTION, info.caption());
235 
236  TRACE() << "Waiting for reply from signon-ui";
238  new PendingCallWatcherWithContext(m_signonui->queryDialog(uiRequest),
239  this);
240  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
241  this, SLOT(queryUiSlot(QDBusPendingCallWatcher*)));
242 
243  setAutoDestruct(false);
244  return 0;
245 }
246 
248 {
249  TRACE() << "QUERYING INFO";
250 
251  SIGNON_RETURN_IF_CAM_UNAVAILABLE(QVariantMap());
252 
253  bool ok;
254  SignonIdentityInfo info = queryInfo(ok, false);
255 
256  if (!ok) {
257  TRACE();
258  sendErrorReply(SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME,
259  SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR +
260  QLatin1String("Database querying error occurred."));
261  return QVariantMap();
262  }
263 
264  if (info.isNew()) {
265  TRACE();
266  sendErrorReply(SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME,
267  SIGNOND_IDENTITY_NOT_FOUND_ERR_STR);
268  return QVariantMap();
269  }
270 
271  keepInUse();
272  info.removeSecrets();
273  return info.toMap();
274 }
275 
276 void SignonIdentity::queryUserPassword(const QVariantMap &params,
277  const QDBusConnection &connection,
278  const QDBusMessage &message)
279 {
280  TRACE() << "Waiting for reply from signon-ui";
282  new PendingCallWatcherWithContext(m_signonui->queryDialog(params),
283  connection, message, this);
284  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this,
285  SLOT(verifyUiSlot(QDBusPendingCallWatcher*)));
286 
287  setAutoDestruct(false);
288 }
289 
290 bool SignonIdentity::verifyUser(const QVariantMap &params)
291 {
293 
294  bool ok;
295  SignonIdentityInfo info = queryInfo(ok, true);
296 
297  if (!ok) {
298  BLAME() << "Identity not found.";
299  sendErrorReply(SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME,
300  SIGNOND_IDENTITY_NOT_FOUND_ERR_STR);
301  return false;
302  }
303  if (!info.storePassword() || info.password().isEmpty()) {
304  BLAME() << "Password is not stored.";
305  sendErrorReply(SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME,
306  SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR);
307  return false;
308  }
309 
310  //delay dbus reply, ui interaction might take long time to complete
311  setDelayedReply(true);
312 
313  //create ui request to ask password
314  QVariantMap uiRequest;
315  uiRequest.unite(params);
316  uiRequest.insert(SSOUI_KEY_QUERYPASSWORD, true);
317  uiRequest.insert(SSOUI_KEY_USERNAME, info.userName());
318  uiRequest.insert(SSOUI_KEY_CAPTION, info.caption());
319 
320  queryUserPassword(uiRequest, connection(), message());
321  return false;
322 }
323 
324 bool SignonIdentity::verifySecret(const QString &secret)
325 {
327 
328  bool ok;
329  queryInfo(ok);
330  if (!ok) {
331  TRACE();
332  sendErrorReply(SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME,
333  SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR +
334  QLatin1String("Database querying error occurred."));
335  return false;
336  }
337 
339  bool ret = db->checkPassword(m_pInfo->id(), m_pInfo->userName(), secret);
340 
341  keepInUse();
342  return ret;
343 }
344 
346 {
348 
350  if ((db == 0) || !db->removeCredentials(m_id)) {
351  TRACE() << "Error occurred while inserting/updating credentials.";
352  sendErrorReply(SIGNOND_REMOVE_FAILED_ERR_NAME,
353  SIGNOND_REMOVE_FAILED_ERR_STR +
354  QLatin1String("Database error occurred."));
355  return;
356  }
357  setDelayedReply(true);
358  setAutoDestruct(false);
361  this);
362  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
363  this, SLOT(removeCompleted(QDBusPendingCallWatcher*)));
364  keepInUse();
365 }
366 
367 void SignonIdentity::removeCompleted(QDBusPendingCallWatcher *call)
368 {
369  Q_ASSERT(call != NULL);
370 
371  setAutoDestruct(true);
372  call->deleteLater();
373 
375  qobject_cast<PendingCallWatcherWithContext*>(call);
376  QDBusPendingReply<> signOnUiReply = *call;
377  bool ok = !signOnUiReply.isError();
378  TRACE() << (ok ? "removeIdentityData succeeded" : "removeIdentityData failed");
379 
380  emit infoUpdated((int)SignOn::IdentityRemoved);
381 
382  QDBusMessage reply = context->message().createReply();
383  context->connection().send(reply);
384 }
385 
387 {
388  TRACE() << "Signout request. Identity ID: " << id();
389  /*
390  * - If the identity is stored (thus registered here)
391  * signal 'sign out' to all identities subsribed to this object,
392  * otherwise the only identity subscribed to this is the newly
393  * created client side identity, which called this method.
394  * - This is just a safety check, as the client identity - if it is a new
395  * one - should not inform server side to sign out.
396  */
397  if (id() != SIGNOND_NEW_IDENTITY) {
398  //clear stored sessiondata
399  CredentialsDB *db =
401  if ((db == 0) || !db->removeData(m_id)) {
402  TRACE() << "clear data failed";
403  }
404 
405  setDelayedReply(true);
406  setAutoDestruct(false);
409  this);
410  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
411  this, SLOT(signOutCompleted(QDBusPendingCallWatcher*)));
412  }
413  keepInUse();
414  return true;
415 }
416 
417 void SignonIdentity::signOutCompleted(QDBusPendingCallWatcher *call)
418 {
419  Q_ASSERT(call != NULL);
420 
421  setAutoDestruct(true);
422  call->deleteLater();
423 
425  qobject_cast<PendingCallWatcherWithContext*>(call);
426  QDBusPendingReply<> signOnUiReply = *call;
427  bool ok = !signOnUiReply.isError();
428  TRACE() << (ok ? "removeIdentityData succeeded" : "removeIdentityData failed");
429 
430  emit infoUpdated((int)SignOn::IdentitySignedOut);
431 
432  QDBusMessage reply = context->message().createReply();
433  reply << ok;
434  context->connection().send(reply);
435 }
436 
437 quint32 SignonIdentity::store(const QVariantMap &info)
438 {
439  keepInUse();
440  SIGNON_RETURN_IF_CAM_UNAVAILABLE(SIGNOND_NEW_IDENTITY);
441 
442  const QDBusContext &context = static_cast<QDBusContext>(*this);
443  QString appId =
445  context.connection(),
446  context.message());
447 
448  const QVariant container = info.value(SIGNOND_IDENTITY_INFO_AUTHMETHODS);
449  MethodMap methods = container.isValid() ?
450  qdbus_cast<MethodMap>(container.value<QDBusArgument>()) : MethodMap();
451 
452  //Add creator to owner list if it has AID
453  QStringList ownerList =
454  info.value(SIGNOND_IDENTITY_INFO_OWNER).toStringList();
455  if (!appId.isNull())
456  ownerList.append(appId);
457 
458  if (m_pInfo == 0) {
459  m_pInfo = new SignonIdentityInfo(info);
460  m_pInfo->setMethods(methods);
461  m_pInfo->setOwnerList(ownerList);
462  } else {
463  if (info.contains(SIGNOND_IDENTITY_INFO_SECRET)) {
464  QString secret = info.value(SIGNOND_IDENTITY_INFO_SECRET).toString();
465  m_pInfo->setPassword(secret);
466  }
467  bool storeSecret =
468  info.value(SIGNOND_IDENTITY_INFO_STORESECRET).toBool();
469  QString userName =
470  info.value(SIGNOND_IDENTITY_INFO_USERNAME).toString();
471  QString caption =
472  info.value(SIGNOND_IDENTITY_INFO_CAPTION).toString();
473  QStringList realms =
474  info.value(SIGNOND_IDENTITY_INFO_REALMS).toStringList();
475  QStringList accessControlList =
476  info.value(SIGNOND_IDENTITY_INFO_ACL).toStringList();
477  int type = info.value(SIGNOND_IDENTITY_INFO_TYPE).toInt();
478 
479  m_pInfo->setStorePassword(storeSecret);
480  m_pInfo->setUserName(userName);
481  m_pInfo->setCaption(caption);
482  m_pInfo->setMethods(methods);
483  m_pInfo->setRealms(realms);
484  m_pInfo->setAccessControlList(accessControlList);
485  m_pInfo->setOwnerList(ownerList);
486  m_pInfo->setType(type);
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
void setRealms(const QStringList &realms)
#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 setStorePassword(bool storePassword)
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)
void setCaption(const QString &caption)
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)
void setAccessControlList(const QStringList &accessControlList)
#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 setUserName(const QString &userName)
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 setOwnerList(const QStringList &owners)