X-Git-Url: https://vcs.maemo.org/git/?p=googlelatitude;a=blobdiff_plain;f=libkqoauth%2Fkqoauthrequest_xauth.cpp;fp=libkqoauth%2Fkqoauthrequest_xauth.cpp;h=0000000000000000000000000000000000000000;hp=92aab5f5e33930175eed1278a489a61361e79837;hb=ca759b3fd3b64ad976c4917e93513b3d05999f13;hpb=0274061406db78bb79ef433c5c438178103aaa58 diff --git a/libkqoauth/kqoauthrequest_xauth.cpp b/libkqoauth/kqoauthrequest_xauth.cpp deleted file mode 100644 index 92aab5f..0000000 --- a/libkqoauth/kqoauthrequest_xauth.cpp +++ /dev/null @@ -1,89 +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 . - */ -#include - -#include "kqoauthrequest_xauth_p.h" -#include "kqoauthrequest_xauth.h" - -/** - * Private d_ptr implementations. - */ -KQOAuthRequest_XAuthPrivate::KQOAuthRequest_XAuthPrivate() -{ - -} - -KQOAuthRequest_XAuthPrivate::~KQOAuthRequest_XAuthPrivate() -{ -} - -/** - * Public implementations. - */ -KQOAuthRequest_XAuth::KQOAuthRequest_XAuth(QObject *parent) : - KQOAuthRequest(parent), - d_ptr(new KQOAuthRequest_XAuthPrivate) -{ -} - -bool KQOAuthRequest_XAuth::isValid() const { - // An xAuth can never request temporary credentials. - if (requestType() == KQOAuthRequest::TemporaryCredentials) { - qWarning() << "XAuth request cannot be of type KQOAuthRequest::TemporaryCredentials. Aborting."; - return false; - } - - // Access token must always be retrieved using the POST HTTP method. - if (requestType() == KQOAuthRequest::AccessToken - && httpMethod() != KQOAuthRequest::POST) { - - qWarning() << "Access tokens must be fetched using the POST HTTP method. Aborting."; - - return false; - } - - if (!xauth_parameters_set) { - qWarning() << "No XAuth parameters set. Aborting."; - return false; - } - - // And then check the validity of the XAuth request. - // Provided by the base class as a protected method for us. - return validateXAuthRequest(); -} - -void KQOAuthRequest_XAuth::setXAuthLogin(const QString &username, - const QString &password) { - - if (username.isEmpty() || password.isEmpty()) { - qWarning() << "Username or password cannot be empty. Aborting."; - return; - } - - xauth_parameters_set = true; - - KQOAuthParameters xauthParams; - xauthParams.insert("x_auth_username", username); - xauthParams.insert("x_auth_password", password); - xauthParams.insert("x_auth_mode", "client_auth"); - - setAdditionalParameters(xauthParams); -} -