oldFlowRequired->setIgnoreCredentialFailure(true);
connect(get, &SimpleNetworkJob::finishedSignal, this, [this]() {
+ _resultGet = Basic;
_getDone = true;
checkAllDone();
});
auto authChallenge = reply->rawHeader("WWW-Authenticate").toLower();
if (authChallenge.contains("bearer ")) {
_resultPropfind = OAuth;
- } else if (authChallenge.isEmpty()) {
- qCWarning(lcDetermineAuthTypeJob) << "Did not receive WWW-Authenticate reply to auth-test PROPFIND";
+ } else {
+ if (authChallenge.isEmpty()) {
+ qCWarning(lcDetermineAuthTypeJob) << "Did not receive WWW-Authenticate reply to auth-test PROPFIND";
+ } else {
+ qCWarning(lcDetermineAuthTypeJob) << "Unknown WWW-Authenticate reply to auth-test PROPFIND:" << authChallenge;
+ }
+ _resultPropfind = Basic;
}
_propfindDone = true;
checkAllDone();
}
}
}
+ } else {
+ _resultOldFlow = Basic;
}
_oldFlowDone = true;
checkAllDone();
return;
}
+ Q_ASSERT(_resultGet != NoAuthType);
+ Q_ASSERT(_resultPropfind != NoAuthType);
+ Q_ASSERT(_resultOldFlow != NoAuthType);
+
auto result = _resultPropfind;
// WebViewFlow > OAuth > Basic
Q_OBJECT
public:
enum AuthType {
+ NoAuthType, // used only before we got a chance to probe the server
Basic, // also the catch-all fallback for backwards compatibility reasons
OAuth,
WebViewFlow,
void checkAllDone();
AccountPtr _account;
- AuthType _resultGet = Basic;
- AuthType _resultPropfind = Basic;
- AuthType _resultOldFlow = Basic;
+ AuthType _resultGet = NoAuthType;
+ AuthType _resultPropfind = NoAuthType;
+ AuthType _resultOldFlow = NoAuthType;
bool _getDone = false;
bool _propfindDone = false;
bool _oldFlowDone = false;