summaryrefslogtreecommitdiffstats
path: root/src/oauth/qoauthhttpserverreplyhandler_p.h
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@qt.io>2024-05-20 12:55:35 +0300
committerJuha Vuolle <juha.vuolle@qt.io>2024-05-23 14:07:18 +0300
commit67b2aec9dd987fc4ea0a7c817639b36380ccaf80 (patch)
tree57fb20d44f3b7cb9ac20f26fd607824fc5acd209 /src/oauth/qoauthhttpserverreplyhandler_p.h
parent7496a1ac994d2e6ea62a4b7be4b7027d4abf6b0a (diff)
Cache callback value / redirect_uri for later use
According to 'RFC 8252 Section 8.3' the loopback listening should be closed after receiving authorization response. There were however two things preventing application developers from doing this: 1) The callback (aka redirect_uri) is needed in the subsequent access token request (note: listening is not needed anymore). 2) The callback (aka redirect_uri) is currently used also in refresh token request (this is unnecessary though, and should be removed in a follow-up commit). But the problem for these two was that the QOAuthHttpServerReplyHandler::callback() code asserted (debug) or just returned a wrong value (release) if the handler wasn't listening. This made it unfeasible to close the handler in a timely manner. With this commit the callback/redirect_uri is cached, and consequently the handler can be closed immediately after authorization. Pick-to: 6.7 6.5 6.2 Fixes: QTBUG-124333 Change-Id: I063637029908ed4fa0390a0cb07511c92bd51874 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/oauth/qoauthhttpserverreplyhandler_p.h')
-rw-r--r--src/oauth/qoauthhttpserverreplyhandler_p.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/oauth/qoauthhttpserverreplyhandler_p.h b/src/oauth/qoauthhttpserverreplyhandler_p.h
index bbc25d8..391516a 100644
--- a/src/oauth/qoauthhttpserverreplyhandler_p.h
+++ b/src/oauth/qoauthhttpserverreplyhandler_p.h
@@ -22,6 +22,7 @@
#include <private/qobject_p.h>
+#include <QtNetwork/qhostaddress.h>
#include <QtNetwork/qtcpserver.h>
QT_BEGIN_NAMESPACE
@@ -34,9 +35,13 @@ public:
explicit QOAuthHttpServerReplyHandlerPrivate(QOAuthHttpServerReplyHandler *p);
~QOAuthHttpServerReplyHandlerPrivate();
+ QString callback() const;
+
QTcpServer httpServer;
QString text;
QString path;
+ QHostAddress callbackAddress;
+ quint16 callbackPort = 0;
private:
void _q_clientConnected();