• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

identity.h

00001 /*
00002  * This file is part of signon
00003  *
00004  * Copyright (C) 2009-2010 Nokia Corporation.
00005  *
00006  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
00007  * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public License
00011  * version 2.1 as published by the Free Software Foundation.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
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,              /* placeholder to rearrange enumeration */
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 &params);
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 }  // namespace SignOn
00384 
00385 #endif /* IDENTITY_H */

Generated on Wed Jul 13 2011 22:08:28 by  doxygen 1.7.1