| 1 | // Copyright (C) 2017 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QOAUTHHTTPSERVERREPLYHANDLER_H |
| 5 | #define QOAUTHHTTPSERVERREPLYHANDLER_H |
| 6 | |
| 7 | #include <QtNetworkAuth/qoauthglobal.h> |
| 8 | |
| 9 | #ifndef QT_NO_HTTP |
| 10 | |
| 11 | #include <QtNetworkAuth/qoauthoobreplyhandler.h> |
| 12 | |
| 13 | #include <QtNetwork/qhostaddress.h> |
| 14 | |
| 15 | QT_BEGIN_NAMESPACE |
| 16 | |
| 17 | class QUrlQuery; |
| 18 | |
| 19 | class QOAuthHttpServerReplyHandlerPrivate; |
| 20 | class Q_OAUTH_EXPORT QOAuthHttpServerReplyHandler : public QOAuthOobReplyHandler |
| 21 | { |
| 22 | Q_OBJECT |
| 23 | |
| 24 | public: |
| 25 | explicit QOAuthHttpServerReplyHandler(QObject *parent = nullptr); |
| 26 | explicit QOAuthHttpServerReplyHandler(quint16 port, QObject *parent = nullptr); |
| 27 | explicit QOAuthHttpServerReplyHandler(const QHostAddress &address, quint16 port, |
| 28 | QObject *parent = nullptr); |
| 29 | ~QOAuthHttpServerReplyHandler(); |
| 30 | |
| 31 | QString callback() const override; |
| 32 | |
| 33 | QString callbackPath() const; |
| 34 | void setCallbackPath(const QString &path); |
| 35 | |
| 36 | QString callbackText() const; |
| 37 | void setCallbackText(const QString &text); |
| 38 | |
| 39 | quint16 port() const; |
| 40 | |
| 41 | bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0); |
| 42 | void close(); |
| 43 | bool isListening() const; |
| 44 | |
| 45 | private: |
| 46 | Q_DECLARE_PRIVATE(QOAuthHttpServerReplyHandler) |
| 47 | QScopedPointer<QOAuthHttpServerReplyHandlerPrivate> d_ptr; |
| 48 | }; |
| 49 | |
| 50 | QT_END_NAMESPACE |
| 51 | |
| 52 | #endif // QT_NO_HTTP |
| 53 | |
| 54 | #endif // QOAUTHHTTPSERVERREPLYHANDLER_H |
| 55 | |