signon  8.58
signondaemonadaptor.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of signon
00003  *
00004  * Copyright (C) 2009-2010 Nokia Corporation.
00005  * Copyright (C) 2012 Canonical Ltd.
00006  *
00007  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
00008  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public License
00012  * version 2.1 as published by the Free Software Foundation.
00013  *
00014  * This library is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00022  * 02110-1301 USA
00023  */
00024 
00025 #ifndef SIGNONDAEMONADAPTER_H_
00026 #define SIGNONDAEMONADAPTER_H_
00027 
00028 #include <QtCore>
00029 #include <QtDBus>
00030 
00031 #include "signond-common.h"
00032 #include "signondaemon.h"
00033 
00034 
00035 namespace SignonDaemonNS {
00036 
00037 typedef QList<QVariantMap> MapList;
00038 
00039 class SignonDaemonAdaptor: public QDBusAbstractAdaptor
00040 {
00041     Q_OBJECT
00042     Q_CLASSINFO("D-Bus Interface",
00043                 "com.google.code.AccountsSSO.SingleSignOn.AuthService")
00044 
00045 public:
00046     SignonDaemonAdaptor(SignonDaemon *parent);
00047     virtual ~SignonDaemonAdaptor();
00048 
00049     inline const QDBusContext &parentDBusContext() const
00050         { return *static_cast<QDBusContext *>(m_parent); }
00051 
00052 public Q_SLOTS:
00053     void registerNewIdentity(QDBusObjectPath &objectPath);
00054     void getIdentity(const quint32 id, QDBusObjectPath &objectPath,
00055                      QVariantMap &identityData);
00056     QString getAuthSessionObjectPath(const quint32 id, const QString &type);
00057 
00058     QStringList queryMethods();
00059     QStringList queryMechanisms(const QString &method);
00060     void queryIdentities(const QVariantMap &filter);
00061     bool clear();
00062 
00063 private:
00064     void securityErrorReply();
00065     void securityErrorReply(const QDBusConnection &connection,
00066                             const QDBusMessage &message);
00067     bool handleLastError(const QDBusConnection &connection,
00068                          const QDBusMessage &message);
00069     QDBusObjectPath registerObject(const QDBusConnection &connection,
00070                                    QObject *object);
00071 
00072 private Q_SLOTS:
00073     void onIdentityAccessReplyFinished();
00074     void onAuthSessionAccessReplyFinished();
00075 
00076 private:
00077     SignonDaemon *m_parent;
00078 }; //class SignonDaemonAdaptor
00079 
00080 } //namespace SignonDaemonNS
00081 
00082 Q_DECLARE_METATYPE(SignonDaemonNS::MapList)
00083 
00084 #endif /* SIGNONDAEMONADAPTER_H_ */