2012-11-27 15:38:05 +01:00
|
|
|
#ifndef UBUNTUONEAUTHENTICATOR_H
|
|
|
|
#define UBUNTUONEAUTHENTICATOR_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
class QNetworkReply;
|
|
|
|
class NetworkAccessManager;
|
|
|
|
|
|
|
|
class UbuntuOneAuthenticator : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit UbuntuOneAuthenticator(QObject* parent = 0);
|
|
|
|
void StartAuthorisation(const QString& email, const QString& password);
|
|
|
|
|
2012-11-27 18:35:06 +01:00
|
|
|
QString consumer_key() const { return consumer_key_; }
|
|
|
|
QString consumer_secret() const { return consumer_secret_; }
|
|
|
|
QString token() const { return token_; }
|
|
|
|
QString token_secret() const { return token_secret_; }
|
|
|
|
|
2012-11-27 19:56:47 +01:00
|
|
|
static QByteArray GenerateAuthorisationHeader(
|
|
|
|
const QString& consumer_key,
|
|
|
|
const QString& consumer_secret,
|
|
|
|
const QString& token,
|
|
|
|
const QString& token_secret);
|
|
|
|
|
2012-11-27 15:38:05 +01:00
|
|
|
signals:
|
|
|
|
void Finished();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void AuthorisationFinished(QNetworkReply* reply);
|
2012-11-27 19:56:47 +01:00
|
|
|
void CopySSOTokensFinished(QNetworkReply* reply);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void CopySSOTokens();
|
|
|
|
QByteArray GenerateAuthorisationHeader();
|
2012-11-27 15:38:05 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
NetworkAccessManager* network_;
|
2012-11-27 18:35:06 +01:00
|
|
|
|
|
|
|
QString consumer_key_;
|
|
|
|
QString consumer_secret_;
|
|
|
|
|
|
|
|
QString token_;
|
|
|
|
QString token_secret_;
|
2012-11-27 15:38:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // UBUNTUONEAUTHENTICATOR_H
|