2 * KQOAuth - An OAuth authentication library for Qt.
4 * Author: Johan Paul (johan.paul@d-pointer.com)
5 * http://www.d-pointer.com
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.
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.
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/>.
20 #ifndef KQOAUTHREQUEST_P_H
21 #define KQOAUTHREQUEST_P_H
22 #include "kqoauthglobals.h"
23 #include "kqoauthrequest.h"
32 class KQOAUTH_EXPORT KQOAuthRequestPrivate {
35 KQOAuthRequestPrivate();
36 ~KQOAuthRequestPrivate();
38 // Helper methods to get the values for the OAuth request parameters.
39 QString oauthTimestamp() const;
40 QString oauthNonce() const;
41 QString oauthSignature();
43 // Utility methods for making the request happen.
44 void prepareRequest();
46 bool validateRequest() const;
47 QByteArray requestBaseString();
48 QByteArray encodedParamaterList(const QList< QPair<QString, QString> > &requestParameters);
49 void insertAdditionalParams();
50 void insertPostBody();
52 QUrl oauthRequestEndpoint;
53 KQOAuthRequest::RequestHttpMethod oauthHttpMethod;
54 QString oauthHttpMethodString;
55 QString oauthConsumerKey;
56 QString oauthConsumerSecretKey;
58 QString oauthTokenSecret;
59 QString oauthSignatureMethod;
60 QUrl oauthCallbackUrl;
62 QString oauthVerifier;
64 // These will be generated by the helper methods
65 QString oauthTimestamp_;
68 // User specified additional parameters needed for the request.
69 QList< QPair<QString, QString> > additionalParameters;
71 // The raw POST body content as given to the HTTP request.
72 QByteArray postBodyContent;
74 // Protocol parameters.
75 // These parameters are used in the "Authorized" header of the HTTP request.
76 QList< QPair<QString, QString> > requestParameters;
78 KQOAuthRequest::RequestType requestType;
80 //The Content-Type HTTP header
83 //Raw data to post if type is not url-encoded
84 QByteArray postRawData;
86 // Timeout for this request in milliseconds.
93 #endif // KQOAUTHREQUEST_P_H