X-Git-Url: http://git.maemo.org/git/?p=googlelatitude;a=blobdiff_plain;f=libkqoauth%2Fkqoauthrequest.h;fp=libkqoauth%2Fkqoauthrequest.h;h=0000000000000000000000000000000000000000;hp=687daaff23cd58a8eed2aac84c57ac4154fe99e6;hb=ca759b3fd3b64ad976c4917e93513b3d05999f13;hpb=0274061406db78bb79ef433c5c438178103aaa58 diff --git a/libkqoauth/kqoauthrequest.h b/libkqoauth/kqoauthrequest.h deleted file mode 100644 index 687daaf..0000000 --- a/libkqoauth/kqoauthrequest.h +++ /dev/null @@ -1,145 +0,0 @@ -/** - * KQOAuth - An OAuth authentication library for Qt. - * - * Author: Johan Paul (johan.paul@d-pointer.com) - * http://www.d-pointer.com - * - * KQOAuth is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * KQOAuth is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with KQOAuth. If not, see . - */ -#ifndef KQOAUTHREQUEST_H -#define KQOAUTHREQUEST_H - -#include -#include -#include - -#include "kqoauthglobals.h" - -typedef QMultiMap KQOAuthParameters; - -class KQOAuthRequestPrivate; -class KQOAUTH_EXPORT KQOAuthRequest : public QObject -{ - Q_OBJECT -public: - explicit KQOAuthRequest(QObject *parent = 0); - ~KQOAuthRequest(); - - enum RequestType { - TemporaryCredentials = 0, - AccessToken, - AuthorizedRequest - }; - - enum RequestSignatureMethod { - PLAINTEXT = 0, - HMAC_SHA1, - RSA_SHA1 - }; - - enum RequestHttpMethod { - GET = 0, - POST - }; - - /** - * These methods can be overridden in child classes which are different types of - * OAuth requests. - */ - // Validate the request of this type. - virtual bool isValid() const; - - /** - * These methods are OAuth request type specific and not overridden in child - * classes. - * NOTE: Refactorting still a TODO - */ - // Initialize the request of this type. - void initRequest(KQOAuthRequest::RequestType type, const QUrl &requestEndpoint); - - void setConsumerKey(const QString &consumerKey); - void setConsumerSecretKey(const QString &consumerSecretKey); - - // Mandatory methods for acquiring a request token - void setCallbackUrl(const QUrl &callbackUrl); - - // Mandator methods for acquiring a access token - void setTokenSecret(const QString &tokenSecret); - void setToken(const QString &token); - void setVerifier(const QString &verifier); - - // Request signature method to use - HMAC_SHA1 currently only supported - void setSignatureMethod(KQOAuthRequest::RequestSignatureMethod = KQOAuthRequest::HMAC_SHA1); - - // Request's HTTP method. - void setHttpMethod(KQOAuthRequest::RequestHttpMethod = KQOAuthRequest::POST); - KQOAuthRequest::RequestHttpMethod httpMethod() const; - - // Sets the timeout for this request. If the timeout expires, signal "requestTimedout" will be - // emitted from the manager. - // 0 = If set to zero, timeout is disabled. - // TODO: Do we need some request ID now? - void setTimeout(int timeoutMilliseconds); - - // Additional optional parameters to the request. - void setAdditionalParameters(const KQOAuthParameters &additionalParams); - KQOAuthParameters additionalParameters() const; - QList requestParameters(); // This will return all request's parameters in the raw format given - // to the QNetworkRequest. - QByteArray requestBody() const; // This will return the POST body as given to the QNetworkRequest. - - KQOAuthRequest::RequestType requestType() const; - QUrl requestEndpoint() const; - - void setContentType(const QString &contentType); - QString contentType(); - - void setRawData(const QByteArray &rawData); - QByteArray rawData(); - - void clearRequest(); - - // Enable verbose debug output for request content. - void setEnableDebugOutput(bool enabled); - -Q_SIGNALS: - // This signal is emited if the request is not completed before the request's timeout - // value has expired. - void requestTimedout(); - -protected: - bool validateXAuthRequest() const; - -private: - KQOAuthRequestPrivate * const d_ptr; - Q_DECLARE_PRIVATE(KQOAuthRequest); - Q_DISABLE_COPY(KQOAuthRequest); - - // These classes are only for the internal use of KQOAuthManager so it can - // work with the opaque request. - QString consumerKeyForManager() const; - QString consumerKeySecretForManager() const; - QUrl callbackUrlForManager() const; - - // This method is for timeout handling by the KQOAuthManager. - void requestTimerStart(); - void requestTimerStop(); - - friend class KQOAuthManager; -#ifdef UNIT_TEST - friend class Ut_KQOAuth; -#endif -}; - -#endif // KQOAUTHREQUEST_H