00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #ifndef IDENTITY_H
00029 #define IDENTITY_H
00030
00031 #include <QObject>
00032 #include <QByteArray>
00033 #include <QMap>
00034 #include <QString>
00035 #include <QStringList>
00036 #include <QVariant>
00037 #include <QPointer>
00038
00039 #include "libsignoncommon.h"
00040 #include "authsession.h"
00041 #include "identityinfo.h"
00042 #include "signonerror.h"
00043
00044 #define SSO_NEW_IDENTITY 0
00045
00046 namespace SignOn {
00047
00048 typedef QPointer<AuthSession> AuthSessionP;
00049
00057 class SIGNON_EXPORT Identity : public QObject
00058 {
00059 Q_OBJECT
00060 Q_DISABLE_COPY(Identity)
00061
00062 friend class IdentityImpl;
00063
00064 public:
00070 enum IdentityError {
00071 UnknownError = 1,
00072 InternalServerError = 2,
00073 InternalCommunicationError = 3,
00074 PermissionDeniedError = 4,
00075 IdentityErr = 200,
00076 MethodNotAvailableError,
00077 NotFoundError,
00078 StoreFailedError,
00079 RemoveFailedError,
00080 SignOutFailedError,
00081 CanceledError,
00082 CredentialsNotAvailableError
00083 };
00084
00085 protected:
00089 Identity(const quint32 id = SSO_NEW_IDENTITY,
00090 QObject *parent = 0);
00091
00092 public:
00102 static Identity *newIdentity(const IdentityInfo &info = IdentityInfo(), QObject *parent = 0);
00103
00113 static Identity *existingIdentity(const quint32 id, QObject *parent = 0);
00114
00118 virtual ~Identity();
00119
00126 quint32 id() const;
00127
00138 void queryAvailableMethods();
00139
00148 AuthSessionP createSession(const QString &methodName);
00149
00155 void destroySession(const AuthSessionP &session);
00156
00172 void requestCredentialsUpdate(const QString &message = QString());
00173
00194 void storeCredentials(const IdentityInfo &info = IdentityInfo());
00195
00208 void remove();
00209
00222 void addReference(const QString &reference = QString());
00223
00236 void removeReference(const QString &reference = QString());
00237
00251 void queryInfo();
00252
00265 void verifyUser(const QString &message = QString());
00266
00279 void verifyUser(const QVariantMap ¶ms);
00280
00292 void verifySecret(const QString &secret);
00293
00306 void signOut();
00307
00308 Q_SIGNALS:
00309
00320 void error(const SignOn::Error &err);
00321
00328 void methodsAvailable(const QStringList &methods);
00329
00335 void credentialsStored(const quint32 id);
00336
00342 void referenceAdded();
00343
00349 void referenceRemoved();
00350
00355 void info(const SignOn::IdentityInfo &info);
00356
00361 void userVerified(const bool valid);
00362
00367 void secretVerified(const bool valid);
00368
00372 void signedOut();
00373
00377 void removed();
00378
00379 private:
00380 class IdentityImpl *impl;
00381 };
00382
00383 }
00384
00385 #endif