| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef OAUTHHTTPHANDLER_H |
| 4 | #define OAUTHHTTPHANDLER_H |
| 5 | |
| 6 | #include "network-web/httpserver.h" |
| 7 | |
| 8 | class OAuthHttpHandler : public HttpServer { |
| 9 | Q_OBJECT |
| 10 | |
| 11 | public: |
| 12 | explicit OAuthHttpHandler(const QString& success_text, QObject* parent = nullptr); |
| 13 | virtual ~OAuthHttpHandler(); |
| 14 | |
| 15 | signals: |
| 16 | void authRejected(const QString& error_description, const QString& state); |
| 17 | void authGranted(const QString& auth_code, const QString& state); |
| 18 | |
| 19 | protected: |
| 20 | virtual void answerClient(QTcpSocket* socket, const HttpRequest& request); |
| 21 | |
| 22 | private: |
| 23 | void handleRedirection(const QVariantMap& data); |
| 24 | |
| 25 | private: |
| 26 | QString m_successText; |
| 27 | }; |
| 28 | |
| 29 | #endif // OAUTHHTTPHANDLER_H |