diff options
author | Fabian Müller <fmueller@owncloud.com> | 2022-06-09 16:46:19 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2022-07-01 18:46:52 +0300 |
commit | b4048e5287f4c50c95f24024488638b667f304a5 (patch) | |
tree | 154dc856e47592fb516d0a4fb021d08af3fe6900 /src | |
parent | 6890ef92d3b19e48d3859e05598e5617c1abef2b (diff) |
Fix logging of auth type
Diffstat (limited to 'src')
-rw-r--r-- | src/libsync/determineauthtypejobfactory.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/libsync/determineauthtypejobfactory.cpp b/src/libsync/determineauthtypejobfactory.cpp index f83cfd6fa..9ec017089 100644 --- a/src/libsync/determineauthtypejobfactory.cpp +++ b/src/libsync/determineauthtypejobfactory.cpp @@ -60,18 +60,21 @@ CoreJob *DetermineAuthTypeJobFactory::startJob(const QUrl &url) const auto authChallenge = reply->rawHeader(QByteArrayLiteral("WWW-Authenticate")).toLower(); - // we fall back to basic in any case - if (authChallenge.contains(QByteArrayLiteral("bearer "))) { - setJobResult(job, QVariant::fromValue(AuthType::OAuth)); - } else { - if (authChallenge.isEmpty()) { - qCWarning(lcDetermineAuthTypeJob) << "Did not receive WWW-Authenticate reply to auth-test PROPFIND"; + const AuthType authType = [authChallenge]() { + // we fall back to basic in any case + if (authChallenge.contains(QByteArrayLiteral("bearer "))) { + return AuthType::OAuth; + } else { + if (authChallenge.isEmpty()) { + qCWarning(lcDetermineAuthTypeJob) << "Did not receive WWW-Authenticate reply to auth-test PROPFIND"; + } + + return AuthType::Basic; } + }(); - setJobResult(job, QVariant::fromValue(AuthType::Basic)); - } - - qCInfo(lcDetermineAuthTypeJob) << "Auth type for" << reply->url() << "is" << job->result(); + qCInfo(lcDetermineAuthTypeJob) << "Auth type for" << reply->url() << "is" << authType; + setJobResult(job, qVariantFromValue(authType)); }); return job; |