- Main Page
- Classes
- Files

- File List

authpluginif.h
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 */
27 #ifndef AUTHPLUGINIF_H
28 #define AUTHPLUGINIF_H
29
30 #include <QtCore/qobject.h>
31 #include <QtCore/qpointer.h>
32 #include <QtCore/qplugin.h>
33
34 #include <QVariantMap>
35 #include <SignOn/sessiondata.h>
36 #include <SignOn/uisessiondata.h>
37 #include <SignOn/signonerror.h>
38
39 QT_BEGIN_NAMESPACE
40 class QString;
41 class QStringList;
42 class QByteArray;
43 class QVariant;
44 QT_END_NAMESPACE
45
49 enum AuthPluginState {
50 PLUGIN_STATE_NONE = 0,
51 PLUGIN_STATE_RESOLVING,
52 PLUGIN_STATE_CONNECTING,
53 PLUGIN_STATE_SENDING,
54 PLUGIN_STATE_WAITING,
55 PLUGIN_STATE_PENDING,
56 PLUGIN_STATE_REFRESHING,
57 PLUGIN_STATE_CANCELING,
58 PLUGIN_STATE_HOLDING,
59 PLUGIN_STATE_DONE
60 };
61
66 #define SIGNON_PLUGIN_INSTANCE(pluginclass) \
67 { \
68 static AuthPluginInterface *_instance = 0; \
69 if (!_instance) \
70 _instance = static_cast<AuthPluginInterface *>(new pluginclass()); \
71 return _instance; \
72 }
73
74 #define SIGNON_DECL_AUTH_PLUGIN(pluginclass) \
75 Q_EXTERN_C AuthPluginInterface *auth_plugin_instance() \
76 SIGNON_PLUGIN_INSTANCE(pluginclass)
77
82 class AuthPluginInterface : public QObject
83 {
84 Q_OBJECT
85
86 public:
87 AuthPluginInterface(QObject *parent = 0) : QObject(parent)
88 { qRegisterMetaType<SignOn::Error>("SignOn::Error"); }
89
93 virtual ~AuthPluginInterface() {}
94
100 virtual QString type() const = 0;
101
107 virtual QStringList mechanisms() const = 0;
108
115 virtual void cancel() {}
116
123 virtual void abort() {}
124
138 virtual void process(const SignOn::SessionData &inData,
139 const QString &mechanism = QString()) = 0;
140
141 Q_SIGNALS:
148 void result(const SignOn::SessionData &data);
149
160 void store(const SignOn::SessionData &data);
161
169 void error(const SignOn::Error &err);
170
183 void userActionRequired(const SignOn::UiSessionData &data);
184
192 void refreshed(const SignOn::UiSessionData &data);
193
201 void statusChanged(const AuthPluginState state,
202 const QString &message = QString());
203
204 public Q_SLOTS:
215 virtual void userActionFinished(const SignOn::UiSessionData &data) {
216 Q_UNUSED(data);
217 }
218
231 virtual void refresh(const SignOn::UiSessionData &data) {
232 emit refreshed(data);
233 }
234
235 };
236
237 QT_BEGIN_NAMESPACE
238 Q_DECLARE_INTERFACE(AuthPluginInterface,
239 "com.nokia.SingleSignOn.PluginInterface/1.3")
240 QT_END_NAMESPACE
241 #endif // AUTHPLUGINIF_H
AuthPluginInterface::mechanisms
virtual QStringList mechanisms() const =0
Gets the list of supported mechanisms.
AuthPluginInterface::statusChanged
void statusChanged(const AuthPluginState state, const QString &message=QString())
Emitted to report status of authentication process to signond for informing client application...
SignOn::UiSessionData
Data container to hold values for authentication session.
Definition: uisessiondata.h:74
AuthPluginInterface::userActionRequired
void userActionRequired(const SignOn::UiSessionData &data)
Emitted when authentication process need to interact with user.
AuthPluginInterface::abort
virtual void abort()
Requests to abort the process.
Definition: authpluginif.h:123
AuthPluginInterface::result
void result(const SignOn::SessionData &data)
Emitted when authentication process has been completed for given data and there are no errors...
AuthPluginInterface
Definition: authpluginif.h:82
AuthPluginInterface::refresh
virtual void refresh(const SignOn::UiSessionData &data)
Refreshes given session.
Definition: authpluginif.h:231
AuthPluginInterface::store
void store(const SignOn::SessionData &data)
Emitted when authentication process want to store session data parameters for later use...
AuthPluginInterface::cancel
virtual void cancel()
Requests to cancel the process.
Definition: authpluginif.h:115
AuthPluginInterface::error
void error(const SignOn::Error &err)
Emitted when authentication process has been completed for given data and resulting an error...
AuthPluginInterface::~AuthPluginInterface
virtual ~AuthPluginInterface()
Destructor.
Definition: authpluginif.h:93
AuthPluginInterface::userActionFinished
virtual void userActionFinished(const SignOn::UiSessionData &data)
User interaction completed.
Definition: authpluginif.h:215
AuthPluginInterface::type
virtual QString type() const =0
Gets the type of the plugin.
AuthPluginInterface::process
virtual void process(const SignOn::SessionData &inData, const QString &mechanism=QString())=0
Process authentication.
AuthPluginInterface::refreshed
void refreshed(const SignOn::UiSessionData &data)
Emitted when authentication process has completed refresh request.