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
path: root/src
diff options
context:
space:
mode:
authorFabian Müller <fmueller@owncloud.com>2022-06-09 16:46:19 +0300
committerHannah von Reth <vonreth@kde.org>2022-07-01 18:46:52 +0300
commitb4048e5287f4c50c95f24024488638b667f304a5 (patch)
tree154dc856e47592fb516d0a4fb021d08af3fe6900 /src
parent6890ef92d3b19e48d3859e05598e5617c1abef2b (diff)
Fix logging of auth type
Diffstat (limited to 'src')
-rw-r--r--src/libsync/determineauthtypejobfactory.cpp23
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;