File indexing completed on 2024-12-22 04:57:54

0001 /*
0002     SPDX-License-Identifier: BSD-2-Clause
0003 */
0004 
0005 #pragma once
0006 
0007 #include <QByteArray>
0008 #include <QMap>
0009 #include <QString>
0010 #include <QTcpServer>
0011 
0012 /// HTTP server to process authentication response.
0013 class O2ReplyServer : public QTcpServer
0014 {
0015     Q_OBJECT
0016 
0017 public:
0018     explicit O2ReplyServer(QObject *parent = nullptr);
0019 
0020     /// Page content on local host after successful oauth - in case you do not want to close the browser, but display something
0021     Q_PROPERTY(QByteArray replyContent READ replyContent WRITE setReplyContent)
0022     QByteArray replyContent() const;
0023     void setReplyContent(const QByteArray &value);
0024 
0025 Q_SIGNALS:
0026     void verificationReceived(const QMultiMap<QString, QString> &);
0027 
0028 public Q_SLOTS:
0029     void onIncomingConnection();
0030     void onBytesReady();
0031     QMultiMap<QString, QString> parseQueryParams(QByteArray *data);
0032 
0033 protected:
0034     QByteArray replyContent_;
0035 };