| 1 |
/** |
| 2 |
* KQOAuth - An OAuth authentication library for Qt. |
| 3 |
* |
| 4 |
* Author: Johan Paul ([email protected]) |
| 5 |
* http://www.johanpaul.com |
| 6 |
* |
| 7 |
* This library is free software; you can redistribute it and/or |
| 8 |
* modify it under the terms of the GNU Lesser General Public |
| 9 |
* License as published by the Free Software Foundation; either |
| 10 |
* version 2.1 of the License, or (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 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 |
KQOAuthRequest::RequestSignatureMethod signatureMethod; |
| 59 |
|
| 60 |
KQOAuthAuthReplyServer *callbackServer; |
| 61 |
|
| 62 |
bool hasTemporaryToken; |
| 63 |
bool isVerified; |
| 64 |
bool isAuthorized; |
| 65 |
bool autoAuth; |
| 66 |
bool handleAuthPageOpening; |
| 67 |
QNetworkAccessManager *networkManager; |
| 68 |
bool managerUserSet; |
| 69 |
QMap<QNetworkReply*, int> requestIds; |
| 70 |
|
| 71 |
QMap<KQOAuthRequest*, QNetworkReply*> requestMap; |
| 72 |
|
| 73 |
Q_DECLARE_PUBLIC(KQOAuthManager); |
| 74 |
}; |
| 75 |
|
| 76 |
#endif // KQOAUTHMANAGER_P_H |