/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2018 Simon Stürz * * * * This file is part of nymea-remoteproxy. * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef AUTHENTICATIONPROCESS_H #define AUTHENTICATIONPROCESS_H #include #include #include #include #include "userinformation.h" #include "authentication/authenticator.h" namespace remoteproxy { class AuthenticationProcess : public QObject { Q_OBJECT public: explicit AuthenticationProcess(QNetworkAccessManager *manager, const QString &accessKey, const QString &secretAccessKey, const QString &sessionToken, QObject *parent = nullptr); private: QNetworkAccessManager *m_manager = nullptr; QString m_accessKey; QString m_secretAccessKey; QString m_sessionToken; QString m_token; QString m_resultFileName; bool m_fallback = false; QProcess *m_process = nullptr; QElapsedTimer m_lambdaTimer; QElapsedTimer m_processTimer; void invokeLambdaFunction(); void startVerificationProcess(); void cleanUp(); signals: void authenticationFinished(Authenticator::AuthenticationError error, const UserInformation &userInformation = UserInformation()); private slots: void onLambdaInvokeFunctionFinished(); void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); public slots: void authenticate(const QString &token); }; } #endif // AUTHENTICATIONPROCESS_H