summaryrefslogtreecommitdiffstats
path: root/src/oauth/qoauth2deviceauthorizationflow.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2025-01-22 10:32:20 +0100
committerMarc Mutz <marc.mutz@qt.io>2025-01-24 16:56:28 +0100
commitb565a5fe88f12fd3e76946bee7a9fa2ef5966f65 (patch)
treef1e5d0191326354940c87a81dd47bd8a49342d9c /src/oauth/qoauth2deviceauthorizationflow.cpp
parent0d902954643ddd22908bd4b6a69701766aee01ed (diff)
QAbstractOAuth2: remember property by which the scope came in
In order to preserve the behavior of QAbstractOAuth2::scope vis-a-vis Qt 6.8, remember which of the scope/requestedScopeTokens proeprties the requested scope came in. If it was the legacy scope, then use that unchanged, like in Qt 6.8. If it was the new property, build a scope from the requestedScopeTokens. This only significant in two cases: - If the user is interacting with a server that wrongfully assigns meaning to the order of scope-tokens in a scope. Routing scope-tokens through QSet could then cause the server to malfunction. - If the user passed (and/or the server expected) invalid characters in scope-tokens, and those characters were outside the L1 range, then they would have been encoded as UTF-8 in 6.8 and are not representable in requestedScopeTokens (they're not L1 and when putting them in as UTF-8-encoded, we'll produce mojibake). Keeping the old behavior for the legacy scope property allows users to continue development while they argue their case in a bug report against the new property. Move the legacyScope member around to avoid padding holes with the new bool property. Pick-to: 6.9 Change-Id: Ic3a7d485990608ea4f48327e69f9b35accbb2cbf Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'src/oauth/qoauth2deviceauthorizationflow.cpp')
-rw-r--r--src/oauth/qoauth2deviceauthorizationflow.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/oauth/qoauth2deviceauthorizationflow.cpp b/src/oauth/qoauth2deviceauthorizationflow.cpp
index 6ac27b9..a0f6411 100644
--- a/src/oauth/qoauth2deviceauthorizationflow.cpp
+++ b/src/oauth/qoauth2deviceauthorizationflow.cpp
@@ -657,6 +657,12 @@ void QOAuth2DeviceAuthorizationFlow::grant()
QMultiMap<QString, QVariant> parameters;
parameters.insert(QtOAuth2RfcKeywords::clientIdentifier, d->clientIdentifier);
+#ifndef QOAUTH2_NO_LEGACY_SCOPE
+ if (d->legacyScopeWasSetByUser) {
+ if (!d->legacyScope.isEmpty())
+ parameters.insert(QtOAuth2RfcKeywords::scope, d->legacyScope);
+ } else
+#endif
if (!d->requestedScopeTokens.isEmpty())
parameters.insert(QtOAuth2RfcKeywords::scope, d->joinedScope(d->requestedScopeTokens));
if (d->authorizationShouldIncludeNonce()) {