LatitudeUpdater 0.1, fix the previous commit
[googlelatitude] / libkqoauth / kqoauthmanager_p.h
1 /**
2  * KQOAuth - An OAuth authentication library for Qt.
3  *
4  * Author: Johan Paul (johan.paul@d-pointer.com)
5  *         http://www.d-pointer.com
6  *
7  *  KQOAuth is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU Lesser General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  KQOAuth is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public License
18  *  along with KQOAuth.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 #ifndef KQOAUTHMANAGER_P_H
21 #define KQOAUTHMANAGER_P_H
22
23 #include "kqoauthauthreplyserver.h"
24 #include "kqoauthrequest.h"
25
26 class KQOAUTH_EXPORT KQOAuthManagerPrivate {
27
28 public:
29     KQOAuthManagerPrivate(KQOAuthManager *parent);
30     ~KQOAuthManagerPrivate();
31
32     QList< QPair<QString, QString> > createQueryParams(const KQOAuthParameters &requestParams);
33     QMultiMap<QString, QString> createTokensFromResponse(QByteArray reply);
34     bool setSuccessfulRequestToken(const QMultiMap<QString, QString> &request);
35     bool setSuccessfulAuthorized(const QMultiMap<QString, QString> &request);
36     void emitTokens();
37     bool setupCallbackServer();
38
39     KQOAuthManager::KQOAuthError error;
40     KQOAuthRequest *r;                  // This request is used to cache the user sent request.
41     KQOAuthRequest *opaqueRequest;       // This request is used to creating opaque convenience requests for the user.
42     KQOAuthManager * const q_ptr;
43
44     /**
45      * The items below are needed in order to store the state of the manager and
46      * by that be able to do convenience operations for the user.
47      */
48     KQOAuthRequest::RequestType currentRequestType;
49
50     // Variables we store here for opaque request handling.
51     // NOTE: The variables are labeled the same for both access token request
52     //       and protected resource access.
53     QString requestToken;
54     QString requestTokenSecret;
55     QString consumerKey;
56     QString consumerKeySecret;
57     QString requestVerifier;
58
59     KQOAuthAuthReplyServer *callbackServer;
60
61     bool hasTemporaryToken;
62     bool isVerified;
63     bool isAuthorized;
64     bool autoAuth;
65     QNetworkAccessManager *networkManager;
66     bool managerUserSet;
67
68     Q_DECLARE_PUBLIC(KQOAuthManager);
69 };
70
71 #endif // KQOAUTHMANAGER_P_H