- Main Page
- Related Pages
- Classes
- Files

- File List

authsession.h
1 /*
2 * This file is part of signon
3 *
4 * Copyright (C) 2009-2010 Nokia Corporation.
5 *
6 * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
7 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * version 2.1 as published by the Free Software Foundation.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
28 #ifndef AUTHSESSION_H
29 #define AUTHSESSION_H
30
31 #include <QObject>
32 #include <QString>
33 #include <QStringList>
34 #include <QByteArray>
35 #include <QVariant>
36
37 #include "libsignoncommon.h"
38 #include "sessiondata.h"
39 #include "signonerror.h"
40
41 namespace SignOnTests {
42 class AccessControlTest;
43 };
44
45 namespace SignOn {
46
54 class SIGNON_EXPORT AuthSession: public QObject
55 {
56 Q_OBJECT
57 Q_DISABLE_COPY(AuthSession)
58
59 friend class IdentityImpl;
60 friend class AuthSessionImpl;
61 friend class SignOnTests::AccessControlTest;
62
63 public:
69 enum AuthSessionError {
70 UnknownError = 1,
71 InternalServerError = 2,
72 InternalCommunicationError = 3,
73 PermissionDeniedError = 4,
74 AuthSessionErr = 300, /* placeholder to rearrange enumeration */
75 MechanismNotAvailableError,
76 MissingDataError,
77 InvalidCredentialsError,
78 WrongStateError,
79 OperationNotSupportedError,
80 NoConnectionError,
81 NetworkError,
82 SslError,
83 RuntimeError,
84 CanceledError,
85 TimedOutError,
86 UserInteractionError
87 };
88
95 enum AuthSessionState {
96 SessionNotStarted = 0,
97 HostResolving,
98 ServerConnecting,
99 DataSending,
100 ReplyWaiting,
101 UserPending,
102 UiRefreshing,
103 ProcessPending,
104 SessionStarted,
105 ProcessCanceling,
106 ProcessDone,
107 CustomState,
108 MaxState,
109 };
110
111 protected:
115 AuthSession(quint32 id, const QString &methodName, QObject *parent = 0);
116 ~AuthSession();
117
118 public:
124 const QString name() const;
125
136 void queryAvailableMechanisms(const QStringList &wantedMechanisms = QStringList());
137
167 void process(const SessionData &sessionData,
168 const QString &mechanism = QString());
169
183 void challenge(const SessionData& sessionData,
184 const QString &mechanism = QString()) {
185 process(sessionData, mechanism);
186 }
187
201 void request(const SessionData &sessionData,
202 const QString &mechanism = QString()) {
203 process(sessionData, mechanism);
204 }
205
214 void cancel();
215
224 void signMessage(const SessionData &params,
225 const QString &mechanism = QString()) {
226 process(params, mechanism);
227 }
228
229 Q_SIGNALS:
240 void error(const SignOn::Error &err);
241
248 void mechanismsAvailable(const QStringList &mechanisms);
249
262 void response(const SignOn::SessionData &sessionData);
263
270 void stateChanged(AuthSession::AuthSessionState state,
271 const QString &message);
272
273 private:
274 class AuthSessionImpl *impl;
275 };
276
277 } // namespace SignOn
278
279 Q_DECLARE_METATYPE(SignOn::AuthSession::AuthSessionState)
280
281 #endif // AUTHSESSION_H
SignOn::AuthSession::MissingDataError
Definition: authsession.h:76
SignOn::AuthSession::ProcessCanceling
Definition: authsession.h:105
SignOn::AuthSession::HostResolving
Definition: authsession.h:97
SignOn::AuthSession::OperationNotSupportedError
Definition: authsession.h:79
SignOn::AuthSession::WrongStateError
Definition: authsession.h:78
SignOn::AuthSession::ReplyWaiting
Definition: authsession.h:100
SignOn::AuthSession::MechanismNotAvailableError
Definition: authsession.h:75
SignOn::AuthSession::SessionStarted
Definition: authsession.h:104
SignOn::AuthSession::UserPending
Definition: authsession.h:101
SignOn::AuthSession::InvalidCredentialsError
Definition: authsession.h:77
SignOn::SessionData
Data container to hold values for authentication session.
Definition: sessiondata.h:90
SignOn::AuthSession::ProcessPending
Definition: authsession.h:103
SignOn::AuthSession::ProcessDone
Definition: authsession.h:106
SignOn::AuthSession::AuthSessionError
AuthSessionError
Codes for errors that may be reported by AuthSession objects.
Definition: authsession.h:69
SignOn::AuthSession::SslError
Definition: authsession.h:82
SignOn::AuthSession::NoConnectionError
Definition: authsession.h:80
SignOn::AuthSession::CustomState
Definition: authsession.h:107
SignOn::AuthSession::CanceledError
Definition: authsession.h:84
SignOn::AuthSession::DataSending
Definition: authsession.h:99
SignOn::AuthSession::TimedOutError
Definition: authsession.h:85
SignOn::AuthSession::request
void request(const SessionData &sessionData, const QString &mechanism=QString())
Sends a request to the authentication service.
Definition: authsession.h:201
SignOn::AuthSession::challenge
void challenge(const SessionData &sessionData, const QString &mechanism=QString())
Sends a challenge to the authentication service.
Definition: authsession.h:183
SignOn::Error
definition for Signon error handling.
Definition: signonerror.h:49
SignOn::AuthSession::AuthSessionState
AuthSessionState
Codes for the states of the AuthSession object.
Definition: authsession.h:95
SignOn::AuthSession::NetworkError
Definition: authsession.h:81
SignOn::AuthSession::signMessage
void signMessage(const SessionData &params, const QString &mechanism=QString())
Signs message by using secret stored into identity.
Definition: authsession.h:224
SignOn::AuthSession::RuntimeError
Definition: authsession.h:83
SignOn::AuthSession::UiRefreshing
Definition: authsession.h:102
SignOn::AuthSession::ServerConnecting
Definition: authsession.h:98
SignOn::AuthSession
Represents a session to authentication plugin/server.
Definition: authsession.h:54