summaryrefslogtreecommitdiffstats
path: root/src/oauth/qoauth2authorizationcodeflow.cpp
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2024-12-16 15:23:27 +0100
committerIvan Solovev <ivan.solovev@qt.io>2024-12-19 09:31:19 +0100
commit2b1e3419c5ef43e964f40dbe79d7a7da0de5aa57 (patch)
tree41b134f7ed12c796cacf20bfb9cddf3f4d4512fc /src/oauth/qoauth2authorizationcodeflow.cpp
parent13d2e25da470494e0b8e668b6ef225b8f1c3dbb4 (diff)
Qt 7: add QAbstractOAuth2::refreshTokens() virtual slot
The base class already contains all properties and signals related to access token refreshing. However, we can not add a new virtual slot during Qt 6 lifetime. This patch pre-programs the addition of this slot to Qt 7 and adjusts the refresh token logic to call the new slot directly from the base class. This eliminates the need to manually implement auto-refresh logic in the derived classes. The name of the new slot is different from the pre-existing slots in the derived classes, so this patch also pre-programs the renaming of the relevant slots. The patch also pre-programs documentation changes by providing Qt 7 versions of the relevant docs. Picking this change to 6.9 to minimize the amount of merge conflict resolutions. Task-number: QTBUG-132106 Pick-to: 6.9 Change-Id: I453e9aae096abbfddcb8076f808d4a055850f7e0 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'src/oauth/qoauth2authorizationcodeflow.cpp')
-rw-r--r--src/oauth/qoauth2authorizationcodeflow.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/oauth/qoauth2authorizationcodeflow.cpp b/src/oauth/qoauth2authorizationcodeflow.cpp
index b75b1a1..aaf9614 100644
--- a/src/oauth/qoauth2authorizationcodeflow.cpp
+++ b/src/oauth/qoauth2authorizationcodeflow.cpp
@@ -178,6 +178,7 @@ QByteArray QOAuth2AuthorizationCodeFlowPrivate::createPKCEChallenge()
Q_UNREACHABLE_RETURN({});
}
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
void QOAuth2AuthorizationCodeFlowPrivate::initializeAutoRefresh()
{
Q_Q(QOAuth2AuthorizationCodeFlow);
@@ -186,6 +187,7 @@ void QOAuth2AuthorizationCodeFlowPrivate::initializeAutoRefresh()
q->refreshAccessToken();
});
}
+#endif
/*!
Constructs a QOAuth2AuthorizationCodeFlow object with parent
@@ -219,8 +221,10 @@ QOAuth2AuthorizationCodeFlow::QOAuth2AuthorizationCodeFlow(const QString &client
manager),
parent)
{
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
Q_D(QOAuth2AuthorizationCodeFlow);
d->initializeAutoRefresh();
+#endif
}
/*!
@@ -237,8 +241,10 @@ QOAuth2AuthorizationCodeFlow::QOAuth2AuthorizationCodeFlow(const QUrl &authentic
QString(), manager),
parent)
{
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
Q_D(QOAuth2AuthorizationCodeFlow);
d->initializeAutoRefresh();
+#endif
}
/*!
@@ -257,8 +263,10 @@ QOAuth2AuthorizationCodeFlow::QOAuth2AuthorizationCodeFlow(const QString &client
clientIdentifier, manager),
parent)
{
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
Q_D(QOAuth2AuthorizationCodeFlow);
d->initializeAutoRefresh();
+#endif
}
/*!
@@ -402,7 +410,11 @@ void QOAuth2AuthorizationCodeFlow::grant()
\sa {https://tools.ietf.org/html/rfc6749#section-1.5}{Refresh
Token}
*/
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
void QOAuth2AuthorizationCodeFlow::refreshAccessToken()
+#else
+void QOAuth2AuthorizationCodeFlow::refreshTokens()
+#endif
{
Q_D(QOAuth2AuthorizationCodeFlow);