00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #ifndef AUTHSESSION_H
00029 #define AUTHSESSION_H
00030
00031 #include <QObject>
00032 #include <QString>
00033 #include <QStringList>
00034 #include <QByteArray>
00035 #include <QVariant>
00036
00037 #include "libsignoncommon.h"
00038 #include "sessiondata.h"
00039 #include "signonerror.h"
00040
00041
00042 namespace SignOn {
00043
00051 class SIGNON_EXPORT AuthSession: public QObject
00052 {
00053 Q_OBJECT
00054 Q_DISABLE_COPY(AuthSession)
00055
00056 friend class IdentityImpl;
00057 friend class AuthSessionImpl;
00058
00059 public:
00065 enum AuthSessionError {
00066 UnknownError = 1,
00067 InternalServerError = 2,
00068 InternalCommunicationError = 3,
00069 PermissionDeniedError = 4,
00070 AuthSessionErr = 300,
00071 MechanismNotAvailableError,
00072 MissingDataError,
00073 InvalidCredentialsError,
00074 WrongStateError,
00075 OperationNotSupportedError,
00076 NoConnectionError,
00077 NetworkError,
00078 SslError,
00079 RuntimeError,
00080 CanceledError,
00081 TimedOutError,
00082 UserInteractionError
00083 };
00084
00091 enum AuthSessionState {
00092 SessionNotStarted = 0,
00093 HostResolving,
00094 ServerConnecting,
00095 DataSending,
00096 ReplyWaiting,
00097 UserPending,
00098 UiRefreshing,
00099 ProcessPending,
00100 SessionStarted,
00101 ProcessCanceling,
00102 ProcessDone,
00103 CustomState,
00104 MaxState,
00105 };
00106
00107 protected:
00111 AuthSession(quint32 id, const QString &methodName, QObject *parent = 0);
00112 ~AuthSession();
00113
00114 public:
00120 const QString name() const;
00121
00132 void queryAvailableMechanisms(const QStringList &wantedMechanisms = QStringList());
00133
00163 void process(const SessionData &sessionData,
00164 const QString &mechanism = QString());
00165
00179 void challenge(const SessionData& sessionData, const QString &mechanism = QString()) {
00180 process(sessionData, mechanism);
00181 }
00182
00196 void request(const SessionData &sessionData, const QString &mechanism = QString()) {
00197 process(sessionData, mechanism);
00198 }
00199
00208 void cancel();
00209
00218 void signMessage(const SessionData ¶ms, const QString &mechanism = QString()) {
00219 process(params, mechanism);
00220 }
00221
00222 Q_SIGNALS:
00223
00234 void error(const SignOn::Error &err);
00235
00242 void mechanismsAvailable(const QStringList &mechanisms);
00243
00256 void response(const SignOn::SessionData &sessionData);
00257
00264 void stateChanged(AuthSession::AuthSessionState state, const QString &message);
00265
00266 private:
00267 class AuthSessionImpl *impl;
00268 };
00269
00270 }
00271
00272 Q_DECLARE_METATYPE(SignOn::AuthSession::AuthSessionState)
00273
00274 #endif // AUTHSESSION_H