signon 8.54

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

pluginproxy.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 *
6 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23 #ifndef PLUGINPROXY_H
24 #define PLUGINPROXY_H
25
26 #include <QDBusConnection>
27 #include <QDBusMessage>
28 #include <QtCore>
29
30 namespace SignOn {
31 class BlobIOHandler;
32 class EncryptedDevice;
33 };
34
35 namespace SignonDaemonNS {
36
42 class PluginProcess: public QProcess
43 {
44 Q_OBJECT
45 friend class PluginProxy;
46
47 PluginProcess(QObject* parent = NULL);
48 ~PluginProcess();
49 };
50
56 class PluginProxy: public QObject
57 {
58 Q_OBJECT
59
60 friend class SignonIdentity;
61 friend class TestAuthSession;
62
63 public:
64 static PluginProxy *createNewPluginProxy(const QString &type);
65 virtual ~PluginProxy();
66
67 bool restartIfRequired();
68 bool isProcessing();
69
70 public Q_SLOTS:
71 QString type() const { return m_type; }
72 QStringList mechanisms() const { return m_mechanisms; }
73 bool process(const QVariantMap &inData,
74 const QString &mechanism);
75 bool processUi(const QVariantMap &inData);
76 bool processRefresh(const QVariantMap &inData);
77 void cancel();
78 void stop();
79
80 Q_SIGNALS:
81 void processResultReply(const QVariantMap &data);
82 void processStore(const QVariantMap &data);
83 void processUiRequest(const QVariantMap &data);
84 void processRefreshRequest(const QVariantMap &data);
85 void processError(int error,
86 const QString &message);
87 void stateChanged(int state,
88 const QString &message);
89
90 private:
91 QString queryType();
92 QStringList queryMechanisms();
93
94 bool waitForStarted(int timeout);
95 bool waitForFinished(int timeout);
96
97 bool readOnReady(QByteArray &buffer, int timeout);
98
99 void handlePluginResponse(const quint32 resultOperation,
100 const QVariantMap &sessionDataMap = QVariantMap());
101
102 bool isResultOperationCodeValid(const int opCode) const;
103
104 private Q_SLOTS:
105 void onReadStandardOutput();
106 void onReadStandardError();
107 void onExit(int exitCode, QProcess::ExitStatus exitStatus);
108 void onError(QProcess::ProcessError err);
109 void sessionDataReceived(const QVariantMap &map);
110 void blobIOError();
111
112 private:
113 PluginProxy(QString type, QObject *parent = NULL);
114
115 bool m_isProcessing;
116 bool m_isResultObtained;
117 QString m_type;
118 QStringList m_mechanisms;
119 int m_uiPolicy;
120 int m_currentResultOperation;
121
122 PluginProcess *m_process;
123 SignOn::BlobIOHandler *m_blobIOHandler;
124 };
125
126 } //namespace SignonDaemonNS
127
128 #endif /* PLUGINPROXY_H */
SignonDaemonNS::PluginProxy::createNewPluginProxy
static PluginProxy * createNewPluginProxy(const QString &type)
Definition: pluginproxy.cpp:138
SignonDaemonNS::PluginProxy::type
QString type() const
Definition: pluginproxy.h:71
SignonDaemonNS::PluginProxy::processResultReply
void processResultReply(const QVariantMap &data)
SignonDaemonNS::PluginProxy::processError
void processError(int error, const QString &message)
SignonDaemonNS::PluginProxy::processRefresh
bool processRefresh(const QVariantMap &inData)
Definition: pluginproxy.cpp:214
SignonDaemonNS::PluginProxy::isProcessing
bool isProcessing()
Definition: pluginproxy.cpp:261
SignonDaemonNS::PluginProxy::processRefreshRequest
void processRefreshRequest(const QVariantMap &data)
SignonDaemonNS::PluginProxy
Plugin proxy.
Definition: pluginproxy.h:56
SignonDaemonNS::PluginProcess
Process to run authentication.
Definition: pluginproxy.h:42
SignonDaemonNS::PluginProxy::restartIfRequired
bool restartIfRequired()
Definition: pluginproxy.cpp:548
SignonDaemonNS::PluginProxy::stateChanged
void stateChanged(int state, const QString &message)
SignonDaemonNS::PluginProxy::process
bool process(const QVariantMap &inData, const QString &mechanism)
Definition: pluginproxy.cpp:176
SignonDaemonNS::PluginProxy::stop
void stop()
Definition: pluginproxy.cpp:239
SignonDaemonNS::PluginProxy::mechanisms
QStringList mechanisms() const
Definition: pluginproxy.h:72
SignonDaemonNS::PluginProxy::processUi
bool processUi(const QVariantMap &inData)
Definition: pluginproxy.cpp:196
SignonDaemonNS::PluginProxy::~PluginProxy
virtual ~PluginProxy()
Definition: pluginproxy.cpp:105
SignonDaemonNS::PluginProxy::processUiRequest
void processUiRequest(const QVariantMap &data)
SignonDaemonNS::PluginProxy::processStore
void processStore(const QVariantMap &data)
SignonDaemonNS::SignonIdentity
Daemon side representation of identity.
Definition: signonidentity.h:50
SignonDaemonNS::PluginProxy::cancel
void cancel()
Definition: pluginproxy.cpp:232
SignonDaemonNS::PluginProxy::TestAuthSession
friend class TestAuthSession
Definition: pluginproxy.h:61