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

authsession.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 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,           /* placeholder to rearrange enumeration */
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 &params, 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 }  // namespace SignOn
00271 
00272 Q_DECLARE_METATYPE(SignOn::AuthSession::AuthSessionState)
00273 
00274 #endif // AUTHSESSION_H

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