Clementine-audio-player-Mac.../src/internet/dropboxauthenticator.h

48 lines
1.1 KiB
C
Raw Normal View History

#ifndef DROPBOXAUTHENTICATOR_H
#define DROPBOXAUTHENTICATOR_H
#include <QObject>
#include <QTcpServer>
class NetworkAccessManager;
class QNetworkReply;
class DropboxAuthenticator : public QObject {
Q_OBJECT
public:
explicit DropboxAuthenticator(QObject* parent = 0);
void StartAuthorisation(const QString& email);
private slots:
void RequestTokenFinished(QNetworkReply* reply);
void RedirectArrived(QTcpSocket* socket, QByteArray buffer);
void NewConnection();
void RequestAccessTokenFinished(QNetworkReply* reply);
void RequestAccountInformationFinished(QNetworkReply* reply);
private:
void Authorise();
void RequestAccessToken();
QByteArray GenerateAuthorisationHeader();
void RequestAccountInformation();
private:
NetworkAccessManager* network_;
QTcpServer server_;
// Temporary access token used for first authentication flow.
QString token_;
QString secret_;
// Permanent OAuth access tokens.
QString access_token_;
QString access_token_secret_;
2012-11-29 17:53:37 +01:00
// User's Dropbox uid & name.
QString uid_;
QString name_;
};
#endif // DROPBOXAUTHENTICATOR_H