54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#ifndef AUTHENTICATIONPROCESS_H
|
|
#define AUTHENTICATIONPROCESS_H
|
|
|
|
#include <QObject>
|
|
#include <QProcess>
|
|
#include <QElapsedTimer>
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include "authenticator.h"
|
|
|
|
namespace remoteproxy {
|
|
|
|
class AuthenticationProcess : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit AuthenticationProcess(QNetworkAccessManager *manager, QObject *parent = nullptr);
|
|
|
|
void useDynamicCredentials(bool dynamicCredentials);
|
|
|
|
private:
|
|
QString m_token;
|
|
QString m_resultFileName;
|
|
|
|
bool m_dynamicCredentials = true;
|
|
QString m_awsAccessKeyId;
|
|
QString m_awsSecretAccessKey;
|
|
QString m_awsSessionToken;
|
|
|
|
QNetworkAccessManager *m_manager = nullptr;
|
|
QProcess *m_process = nullptr;
|
|
QElapsedTimer m_requestTimer;
|
|
QElapsedTimer m_processTimer;
|
|
|
|
void requestDynamicCredentials();
|
|
void startVerificationProcess();
|
|
void cleanUp();
|
|
|
|
signals:
|
|
void authenticationFinished(Authenticator::AuthenticationError error);
|
|
|
|
private slots:
|
|
void onDynamicCredentialsReady();
|
|
void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
|
|
|
public slots:
|
|
void authenticate(const QString &token);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // AUTHENTICATIONPROCESS_H
|