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,
00073 InternalServerError = 2,
00074 InternalCommunicationError = 3,
00076 PermissionDeniedError = 4,
00079 IdentityErr = 200,
00080
00081 MethodNotAvailableError,
00083 NotFoundError,
00086 StoreFailedError,
00087 RemoveFailedError,
00088 SignOutFailedError,
00089 CanceledError,
00090 CredentialsNotAvailableError
00091 };
00092
00093 protected:
00097 Identity(const quint32 id = SSO_NEW_IDENTITY,
00098 QObject *parent = 0);
00099
00100 public:
00110 static Identity *newIdentity(const IdentityInfo &info = IdentityInfo(),
00111 QObject *parent = 0);
00112
00122 static Identity *existingIdentity(const quint32 id, QObject *parent = 0);
00123
00127 virtual ~Identity();
00128
00135 quint32 id() const;
00136
00147 void queryAvailableMethods();
00148
00157 AuthSessionP createSession(const QString &methodName);
00158
00164 void destroySession(const AuthSessionP &session);
00165
00181 void requestCredentialsUpdate(const QString &message = QString());
00182
00203 void storeCredentials(const IdentityInfo &info = IdentityInfo());
00204
00217 void remove();
00218
00231 void addReference(const QString &reference = QString());
00232
00245 void removeReference(const QString &reference = QString());
00246
00260 void queryInfo();
00261
00275 void verifyUser(const QString &message = QString());
00276
00290 void verifyUser(const QVariantMap ¶ms);
00291
00303 void verifySecret(const QString &secret);
00304
00317 void signOut();
00318
00319 Q_SIGNALS:
00320
00331 void error(const SignOn::Error &err);
00332
00339 void methodsAvailable(const QStringList &methods);
00340
00346 void credentialsStored(const quint32 id);
00347
00353 void referenceAdded();
00354
00360 void referenceRemoved();
00361
00366 void info(const SignOn::IdentityInfo &info);
00367
00372 void userVerified(const bool valid);
00373
00378 void secretVerified(const bool valid);
00379
00383 void signedOut();
00384
00388 void removed();
00389
00390 private:
00391 class IdentityImpl *impl;
00392 };
00393
00394 }
00395
00396 #endif