Merge pull request #7976 from nextcloud/backport/7974/stable-3.16

[stable-3.16] always set a user if we got asked for one
This commit is contained in:
Matthieu Gallien 2025-03-06 09:38:31 +01:00 committed by GitHub
commit 50d18ab06d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,6 +36,13 @@ AccessManager::AccessManager(QObject *parent)
: QNetworkAccessManager(parent)
{
setCookieJar(new CookieJar);
connect(this, &QNetworkAccessManager::authenticationRequired, this, [this](QNetworkReply *reply, QAuthenticator *authenticator) {
if (authenticator->user().isEmpty()) {
qCWarning(lcAccessManager) << "Server requested authentication and we didn't provide a user, aborting ...";
authenticator->setUser(QUuid::createUuid().toString());
reply->abort();
}
});
}
QByteArray AccessManager::generateRequestId()