signon  8.54
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  deleteLater();
124 }
125 
126 SignonIdentityInfo SignonIdentity::queryInfo(bool &ok, bool queryPassword)
127 {
128  ok = true;
129 
130  bool needLoadFromDB = true;
131  if (m_pInfo) {
132  needLoadFromDB = false;
133  if (queryPassword && m_pInfo->password().isEmpty()) {
134  needLoadFromDB = true;
135  }
136  }
137 
138  if (needLoadFromDB) {
139  if (m_pInfo != 0) {
140  delete m_pInfo;
141  }
142 
143  CredentialsDB *db =
145  m_pInfo = new SignonIdentityInfo(db->credentials(m_id, queryPassword));
146 
147  if (db->lastError().isValid()) {
148  ok = false;
149  delete m_pInfo;
150  m_pInfo = NULL;
151  return SignonIdentityInfo();
152  }
153  }
154 
155  /* Make sure that we clear the password, if the caller doesn't need it */
156  SignonIdentityInfo info = *m_pInfo;
157  if (!queryPassword) {
158  info.setPassword(QString());
159  }
160  return info;
161 }
162 
163 bool SignonIdentity::addReference(const QString &reference)
164 {
165  TRACE() << "addReference: " << reference;
166 
168 
170  if (db == NULL) {
171  BLAME() << "NULL database handler object.";
172  return false;
173  }
174  const QDBusContext &context = static_cast<QDBusContext>(*this);
175  QString appId =
177  context.connection(),
178  context.message());
179  keepInUse();
180  return db->addReference(m_id, appId, reference);
181 }
182 
183 bool SignonIdentity::removeReference(const QString &reference)
184 {
185  TRACE() << "removeReference: " << reference;
186 
188 
190  if (db == NULL) {
191  BLAME() << "NULL database handler object.";
192  return false;
193  }
194  const QDBusContext &context = static_cast<QDBusContext>(*this);
195  QString appId =
197  context.connection(),
198  context.message());
199  keepInUse();
200  return db->removeReference(m_id, appId, reference);
201 }
202 
203 quint32 SignonIdentity::requestCredentialsUpdate(const QString &displayMessage)
204 {
205  SIGNON_RETURN_IF_CAM_UNAVAILABLE(SIGNOND_NEW_IDENTITY);
206 
207  bool ok;
208  SignonIdentityInfo info = queryInfo(ok, false);
209 
210  if (!ok) {
211  BLAME() << "Identity not found.";
212  sendErrorReply(SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME,
213  SIGNOND_IDENTITY_NOT_FOUND_ERR_STR);
214  return SIGNOND_NEW_IDENTITY;
215  }
216  if (!info.storePassword()) {
217  BLAME() << "Password cannot be stored.";
218  sendErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
219  SIGNOND_STORE_FAILED_ERR_STR);
220  return SIGNOND_NEW_IDENTITY;
221  }
222 
223  //delay dbus reply, ui interaction might take long time to complete
224  setDelayedReply(true);
225 
226  //create ui request to ask password
227  QVariantMap uiRequest;
228  uiRequest.insert(SSOUI_KEY_QUERYPASSWORD, true);
229  uiRequest.insert(SSOUI_KEY_USERNAME, info.userName());
230  uiRequest.insert(SSOUI_KEY_MESSAGE, displayMessage);
231  uiRequest.insert(SSOUI_KEY_CAPTION, info.caption());
232 
233  TRACE() << "Waiting for reply from signon-ui";
235  new PendingCallWatcherWithContext(m_signonui->queryDialog(uiRequest),
236  this);
237  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
238  this, SLOT(queryUiSlot(QDBusPendingCallWatcher*)));
239 
240  setAutoDestruct(false);
241  return 0;
242 }
243 
245 {
246  TRACE() << "QUERYING INFO";
247 
248  SIGNON_RETURN_IF_CAM_UNAVAILABLE(QVariantMap());
249 
250  bool ok;
251  SignonIdentityInfo info = queryInfo(ok, false);
252 
253  if (!ok) {
254  TRACE();
255  sendErrorReply(SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME,
256  SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR +
257  QLatin1String("Database querying error occurred."));
258  return QVariantMap();
259  }
260 
261  if (info.isNew()) {
262  TRACE();
263  sendErrorReply(SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME,
264  SIGNOND_IDENTITY_NOT_FOUND_ERR_STR);
265  return QVariantMap();
266  }
267 
268  keepInUse();
269  return info.toMap();
270 }
271 
272 void SignonIdentity::queryUserPassword(const QVariantMap &params,
273  const QDBusConnection &connection,
274  const QDBusMessage &message)
275 {
276  TRACE() << "Waiting for reply from signon-ui";
278  new PendingCallWatcherWithContext(m_signonui->queryDialog(params),
279  connection, message, this);
280  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this,
281  SLOT(verifyUiSlot(QDBusPendingCallWatcher*)));
282 
283  setAutoDestruct(false);
284 }
285 
286 bool SignonIdentity::verifyUser(const QVariantMap &params)
287 {
289 
290  bool ok;
291  SignonIdentityInfo info = queryInfo(ok, true);
292 
293  if (!ok) {
294  BLAME() << "Identity not found.";
295  sendErrorReply(SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME,
296  SIGNOND_IDENTITY_NOT_FOUND_ERR_STR);
297  return false;
298  }
299  if (!info.storePassword() || info.password().isEmpty()) {
300  BLAME() << "Password is not stored.";
301  sendErrorReply(SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME,
302  SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR);
303  return false;
304  }
305 
306  //delay dbus reply, ui interaction might take long time to complete
307  setDelayedReply(true);
308 
309  //create ui request to ask password
310  QVariantMap uiRequest;
311  uiRequest.unite(params);
312  uiRequest.insert(SSOUI_KEY_QUERYPASSWORD, true);
313  uiRequest.insert(SSOUI_KEY_USERNAME, info.userName());
314  uiRequest.insert(SSOUI_KEY_CAPTION, info.caption());
315 
316  queryUserPassword(uiRequest, connection(), message());
317  return false;
318 }
319 
320 bool SignonIdentity::verifySecret(const QString &secret)
321 {
323 
324  bool ok;
325  queryInfo(ok);
326  if (!ok) {
327  TRACE();
328  sendErrorReply(SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME,
329  SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR +
330  QLatin1String("Database querying error occurred."));
331  return false;
332  }
333 
335  bool ret = db->checkPassword(m_pInfo->id(), m_pInfo->userName(), secret);
336 
337  keepInUse();
338  return ret;
339 }
340 
342 {
344 
346  if ((db == 0) || !db->removeCredentials(m_id)) {
347  TRACE() << "Error occurred while inserting/updating credentials.";
348  sendErrorReply(SIGNOND_REMOVE_FAILED_ERR_NAME,
349  SIGNOND_REMOVE_FAILED_ERR_STR +
350  QLatin1String("Database error occurred."));
351  return;
352  }
353  setDelayedReply(true);
354  setAutoDestruct(false);
357  this);
358  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
359  this, SLOT(removeCompleted(QDBusPendingCallWatcher*)));
360  keepInUse();
361 }
362 
363 void SignonIdentity::removeCompleted(QDBusPendingCallWatcher *call)
364 {
365  Q_ASSERT(call != NULL);
366 
367  setAutoDestruct(true);
368  call->deleteLater();
369 
371  qobject_cast<PendingCallWatcherWithContext*>(call);
372  QDBusPendingReply<> signOnUiReply = *call;
373  bool ok = !signOnUiReply.isError();
374  TRACE() << (ok ? "removeIdentityData succeeded" : "removeIdentityData failed");
375 
376  emit infoUpdated((int)SignOn::IdentityRemoved);
377 
378  QDBusMessage reply = context->message().createReply();
379  context->connection().send(reply);
380 }
381 
383 {
384  TRACE() << "Signout request. Identity ID: " << id();
385  /*
386  * - If the identity is stored (thus registered here)
387  * signal 'sign out' to all identities subsribed to this object,
388  * otherwise the only identity subscribed to this is the newly
389  * created client side identity, which called this method.
390  * - This is just a safety check, as the client identity - if it is a new
391  * one - should not inform server side to sign out.
392  */
393  if (id() != SIGNOND_NEW_IDENTITY) {
394  //clear stored sessiondata
395  CredentialsDB *db =
397  if ((db == 0) || !db->removeData(m_id)) {
398  TRACE() << "clear data failed";
399  }
400 
401  setDelayedReply(true);
402  setAutoDestruct(false);
405  this);
406  connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
407  this, SLOT(signOutCompleted(QDBusPendingCallWatcher*)));
408  }
409  keepInUse();
410  return true;
411 }
412 
413 void SignonIdentity::signOutCompleted(QDBusPendingCallWatcher *call)
414 {
415  Q_ASSERT(call != NULL);
416 
417  setAutoDestruct(true);
418  call->deleteLater();
419 
421  qobject_cast<PendingCallWatcherWithContext*>(call);
422  QDBusPendingReply<> signOnUiReply = *call;
423  bool ok = !signOnUiReply.isError();
424  TRACE() << (ok ? "removeIdentityData succeeded" : "removeIdentityData failed");
425 
426  emit infoUpdated((int)SignOn::IdentitySignedOut);
427 
428  QDBusMessage reply = context->message().createReply();
429  reply << ok;
430  context->connection().send(reply);
431 }
432 
433 quint32 SignonIdentity::store(const QVariantMap &info)
434 {
435  keepInUse();
436  SIGNON_RETURN_IF_CAM_UNAVAILABLE(SIGNOND_NEW_IDENTITY);
437 
438  QString secret = info.value(SIGNOND_IDENTITY_INFO_SECRET).toString();
439  const QDBusContext &context = static_cast<QDBusContext>(*this);
440  QString appId =
442  context.connection(),
443  context.message());
444 
445  bool storeSecret = info.value(SIGNOND_IDENTITY_INFO_STORESECRET).toBool();
446  QVariant container = info.value(SIGNOND_IDENTITY_INFO_AUTHMETHODS);
447  MethodMap methods =
448  qdbus_cast<MethodMap>(container.value<QDBusArgument>());
449 
450  //Add creator to owner list if it has AID
451  QStringList ownerList =
452  info.value(SIGNOND_IDENTITY_INFO_OWNER).toStringList();
453  if (!appId.isNull())
454  ownerList.append(appId);
455 
456  if (m_pInfo == 0) {
457  m_pInfo = new SignonIdentityInfo(info);
458  m_pInfo->setMethods(methods);
459  m_pInfo->setOwnerList(ownerList);
460  } else {
461  QString userName =
462  info.value(SIGNOND_IDENTITY_INFO_USERNAME).toString();
463  QString caption =
464  info.value(SIGNOND_IDENTITY_INFO_CAPTION).toString();
465  QStringList realms =
466  info.value(SIGNOND_IDENTITY_INFO_REALMS).toStringList();
467  QStringList accessControlList =
468  info.value(SIGNOND_IDENTITY_INFO_ACL).toStringList();
469  int type = info.value(SIGNOND_IDENTITY_INFO_TYPE).toInt();
470 
471  m_pInfo->setUserName(userName);
472  m_pInfo->setCaption(caption);
473  m_pInfo->setMethods(methods);
474  m_pInfo->setRealms(realms);
475  m_pInfo->setAccessControlList(accessControlList);
476  m_pInfo->setOwnerList(ownerList);
477  m_pInfo->setType(type);
478  }
479 
480  m_pInfo->setPassword(secret);
481  m_pInfo->setStorePassword(storeSecret);
482  m_id = storeCredentials(*m_pInfo);
483 
484  if (m_id == SIGNOND_NEW_IDENTITY) {
485  sendErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
486  SIGNOND_STORE_FAILED_ERR_STR);
487  }
488 
489  return m_id;
490 }
491 
493 {
495  if (db == NULL) {
496  BLAME() << "NULL database handler object.";
497  return SIGNOND_NEW_IDENTITY;
498  }
499 
500  bool newIdentity = info.isNew();
501 
502  if (newIdentity)
503  m_id = db->insertCredentials(info);
504  else
505  db->updateCredentials(info);
506 
507  if (db->errorOccurred()) {
508  if (newIdentity)
509  m_id = SIGNOND_NEW_IDENTITY;
510 
511  TRACE() << "Error occurred while inserting/updating credentials.";
512  } else {
513  if (m_pInfo) {
514  delete m_pInfo;
515  m_pInfo = NULL;
516  }
517  Q_EMIT stored(this);
518 
519  TRACE() << "FRESH, JUST STORED CREDENTIALS ID:" << m_id;
520  emit infoUpdated((int)SignOn::IdentityDataUpdated);
521  }
522  return m_id;
523 }
524 
525 void SignonIdentity::queryUiSlot(QDBusPendingCallWatcher *call)
526 {
527  TRACE();
528  Q_ASSERT(call != NULL);
529 
530  setAutoDestruct(true);
531 
533  qobject_cast<PendingCallWatcherWithContext*>(call);
534  const QDBusMessage &message = context->message();
535  const QDBusConnection &connection = context->connection();
536 
537  QDBusMessage errReply;
538  QDBusPendingReply<QVariantMap> reply = *call;
539  call->deleteLater();
540 
541  QVariantMap resultParameters;
542  if (!reply.isError() && reply.count()) {
543  resultParameters = reply.argumentAt<0>();
544  } else {
545  errReply = message.createErrorReply(
546  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
547  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
548  connection.send(errReply);
549  return;
550  }
551 
552  if (!resultParameters.contains(SSOUI_KEY_ERROR)) {
553  //no reply code
554  errReply = message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
555  SIGNOND_INTERNAL_SERVER_ERR_STR);
556  connection.send(errReply);
557  return;
558  }
559 
560  int errorCode = resultParameters.value(SSOUI_KEY_ERROR).toInt();
561  TRACE() << "error: " << errorCode;
562  if (errorCode != QUERY_ERROR_NONE) {
563  if (errorCode == QUERY_ERROR_CANCELED)
564  errReply =
565  message.createErrorReply(
566  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
567  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
568  else
569  errReply =
570  message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
571  QString(QLatin1String("signon-ui call returned error %1")).
572  arg(errorCode));
573 
574  connection.send(errReply);
575  return;
576  }
577 
578  if (resultParameters.contains(SSOUI_KEY_PASSWORD)) {
579  CredentialsDB *db =
581  if (db == NULL) {
582  BLAME() << "NULL database handler object.";
583  errReply = message.createErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
584  SIGNOND_STORE_FAILED_ERR_STR);
585  connection.send(errReply);
586  return;
587  }
588 
589  //store new password
590  if (m_pInfo) {
591  m_pInfo->setPassword(resultParameters[SSOUI_KEY_PASSWORD].toString());
592 
593  quint32 ret = db->updateCredentials(*m_pInfo);
594  delete m_pInfo;
595  m_pInfo = NULL;
596  if (ret != SIGNOND_NEW_IDENTITY) {
597  QDBusMessage dbusreply = message.createReply();
598  dbusreply << quint32(m_id);
599  connection.send(dbusreply);
600  return;
601  } else{
602  BLAME() << "Error during update";
603  }
604  }
605  }
606 
607  //this should not happen, return error
608  errReply = message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
609  SIGNOND_INTERNAL_SERVER_ERR_STR);
610  connection.send(errReply);
611  return;
612 }
613 
614 void SignonIdentity::verifyUiSlot(QDBusPendingCallWatcher *call)
615 {
616  TRACE();
617  Q_ASSERT(call != NULL);
618 
619  setAutoDestruct(true);
620 
622  qobject_cast<PendingCallWatcherWithContext*>(call);
623  const QDBusMessage &message = context->message();
624  const QDBusConnection &connection = context->connection();
625 
626  QDBusMessage errReply;
627  QDBusPendingReply<QVariantMap> reply = *call;
628  call->deleteLater();
629  QVariantMap resultParameters;
630  if (!reply.isError() && reply.count()) {
631  resultParameters = reply.argumentAt<0>();
632  } else {
633  errReply =
634  message.createErrorReply(
635  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
636  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
637  connection.send(errReply);
638  return;
639  }
640 
641  if (!resultParameters.contains(SSOUI_KEY_ERROR)) {
642  //no reply code
643  errReply = message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
644  SIGNOND_INTERNAL_SERVER_ERR_STR);
645  connection.send(errReply);
646  return;
647  }
648 
649  int errorCode = resultParameters.value(SSOUI_KEY_ERROR).toInt();
650  TRACE() << "error: " << errorCode;
651  if (errorCode != QUERY_ERROR_NONE) {
652  if (errorCode == QUERY_ERROR_CANCELED)
653  errReply = message.createErrorReply(
654  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
655  SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
656  else if (errorCode == QUERY_ERROR_FORGOT_PASSWORD)
657  errReply = message.createErrorReply(
658  SIGNOND_FORGOT_PASSWORD_ERR_NAME,
659  SIGNOND_FORGOT_PASSWORD_ERR_STR);
660  else
661  errReply = message.createErrorReply(
662  SIGNOND_INTERNAL_SERVER_ERR_NAME,
663  QString(QLatin1String("signon-ui call "
664  "returned error %1")).
665  arg(errorCode));
666 
667  connection.send(errReply);
668  return;
669  }
670 
671  if (resultParameters.contains(SSOUI_KEY_PASSWORD)) {
672  CredentialsDB *db =
674  if (db == NULL) {
675  BLAME() << "NULL database handler object.";
676  errReply = message.createErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
677  SIGNOND_STORE_FAILED_ERR_STR);
678  connection.send(errReply);
679  return;
680  }
681 
682  //compare passwords
683  if (m_pInfo) {
684  bool ret =
685  m_pInfo->password() == resultParameters[SSOUI_KEY_PASSWORD].
686  toString();
687 
688  if (!ret && resultParameters.contains(SSOUI_KEY_CONFIRMCOUNT)) {
689  int count = resultParameters[SSOUI_KEY_CONFIRMCOUNT].toInt();
690  TRACE() << "retry count:" << count;
691  if (count > 0) { //retry
692  resultParameters[SSOUI_KEY_CONFIRMCOUNT] = (count-1);
693  resultParameters[SSOUI_KEY_MESSAGEID] =
694  QUERY_MESSAGE_NOT_AUTHORIZED;
695  queryUserPassword(resultParameters, connection, message);
696  return;
697  } else {
698  //TODO show error note here if needed
699  }
700  }
701  delete m_pInfo;
702  m_pInfo = NULL;
703  QDBusMessage dbusreply = message.createReply();
704  dbusreply << ret;
705  connection.send(dbusreply);
706  return;
707  }
708  }
709  //this should not happen, return error
710  errReply = message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
711  SIGNOND_INTERNAL_SERVER_ERR_STR);
712  connection.send(errReply);
713  return;
714 }
715 
716 } //namespace SignonDaemonNS
717 
718 #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)
void setOwnerList(const QStringList &owner)
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)
void setAccessControlList(const QStringList &acl)
QDBusPendingCall queryDialog(const QVariantMap &parameters)
bool removeReference(const quint32 id, const QString &token, const QString &reference=QString())
const QString internalServerErrStr
QDBusPendingCall removeIdentityData(quint32 id)
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 setUserName(const QString &userName)
void setAutoDestruct(bool value=true) const
Mark the object as used.
SignonIdentityInfo queryInfo(bool &ok, bool queryPassword=true)
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...