| 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 | #ifndef QT_NO_SSL |
| 19 | class QSslConfiguration; |
| 20 | #endif |
| 21 | |
| 22 | class QOAuthHttpServerReplyHandlerPrivate; |
| 23 | class Q_OAUTH_EXPORT QOAuthHttpServerReplyHandler : public QOAuthOobReplyHandler |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | |
| 27 | public: |
| 28 | explicit QOAuthHttpServerReplyHandler(QObject *parent = nullptr); |
| 29 | explicit QOAuthHttpServerReplyHandler(quint16 port, QObject *parent = nullptr); |
| 30 | explicit QOAuthHttpServerReplyHandler(const QHostAddress &address, quint16 port, |
| 31 | QObject *parent = nullptr); |
| 32 | ~QOAuthHttpServerReplyHandler(); |
| 33 | |
| 34 | QString callback() const override; |
| 35 | |
| 36 | QString callbackPath() const; |
| 37 | void setCallbackPath(const QString &path); |
| 38 | |
| 39 | QString callbackHost() const; |
| 40 | void setCallbackHost(const QString &path); |
| 41 | |
| 42 | QString callbackText() const; |
| 43 | void setCallbackText(const QString &text); |
| 44 | |
| 45 | quint16 port() const; |
| 46 | |
| 47 | bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0); |
| 48 | #ifndef QT_NO_SSL |
| 49 | bool listen(const QSslConfiguration &configuration, |
| 50 | const QHostAddress &address = QHostAddress::Any, quint16 port = 0); |
| 51 | #endif |
| 52 | void close(); |
| 53 | bool isListening() const; |
| 54 | |
| 55 | private: |
| 56 | Q_DECLARE_PRIVATE(QOAuthHttpServerReplyHandler) |
| 57 | QScopedPointer<QOAuthHttpServerReplyHandlerPrivate> d_ptr; |
| 58 | }; |
| 59 | |
| 60 | QT_END_NAMESPACE |
| 61 | |
| 62 | #endif // QT_NO_HTTP |
| 63 | |
| 64 | #endif // QOAUTHHTTPSERVERREPLYHANDLER_H |
| 65 |
