Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Müller <fmueller@owncloud.com>2022-01-04 12:44:07 +0300
committerFabian Müller <80399010+fmoc@users.noreply.github.com>2022-01-04 13:27:56 +0300
commit09983d6fe665947bd902cc9bfffea35c8eaba50d (patch)
treef10fbee5f2ace9391dc1319b75e716a173494eb2 /src/libsync
parent973ae2ab82ab9331d73fed978d94be3365a8db7c (diff)
Fix OpenID Connect authentication regression
Introduced in ba37025f4b5ac4a2a6cde6aac7d4a5896cfbac1.
Diffstat (limited to 'src/libsync')
-rw-r--r--src/libsync/creds/oauth.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libsync/creds/oauth.cpp b/src/libsync/creds/oauth.cpp
index e729d63dc..e37df23cb 100644
--- a/src/libsync/creds/oauth.cpp
+++ b/src/libsync/creds/oauth.cpp
@@ -224,16 +224,22 @@ void OAuth::startAuthentication()
httpReplyAndClose(socket, QByteArrayLiteral("400 Bad Request"), QByteArrayLiteral("<html><head><title>400 Bad Request</title></head><body><center><h1>400 Bad Request</h1></center></body></html>"));
return;
}
+
+ // server port cannot be queried any more after server has been closed, which we want to do as early as possible in the processing chain
+ // therefore we have to store it beforehand
+ const auto serverPort = _server.serverPort();
+
// we only allow one response
- qCDebug(lcOauth) << "Recieved the first valid request, stoping to listen";
+ qCDebug(lcOauth) << "Received the first valid response, closing server socket";
_server.close();
auto job = postTokenRequest({
{ QStringLiteral("grant_type"), QStringLiteral("authorization_code") },
{ QStringLiteral("code"), args.queryItemValue(QStringLiteral("code")) },
- { QStringLiteral("redirect_uri"), QStringLiteral("%1:%2").arg(_redirectUrl, QString::number(_server.serverPort())) },
+ { QStringLiteral("redirect_uri"), QStringLiteral("%1:%2").arg(_redirectUrl, QString::number(serverPort)) },
{ QStringLiteral("code_verifier"), QString::fromUtf8(_pkceCodeVerifier) },
});
+
QObject::connect(job, &SimpleNetworkJob::finishedSignal, this, [this, socket](QNetworkReply *reply) {
const auto jsonData = reply->readAll();
QJsonParseError jsonParseError;