From 67b2aec9dd987fc4ea0a7c817639b36380ccaf80 Mon Sep 17 00:00:00 2001 From: Juha Vuolle Date: Mon, 20 May 2024 12:55:35 +0300 Subject: Cache callback value / redirect_uri for later use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: MÃ¥rten Nordheim --- src/oauth/qoauthhttpserverreplyhandler_p.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/oauth/qoauthhttpserverreplyhandler_p.h') 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 +#include #include 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(); -- cgit v1.2.3