CheckServerJob::CheckServerJob(AccountPtr account, QObject *parent) : AbstractNetworkJob(account, QLatin1String(statusphpC) , parent) , _subdirFallback(false) { _followRedirects = true; setIgnoreCredentialFailure(true); }
void DetermineAuthTypeJob::start() { qCInfo(lcDetermineAuthTypeJob) << "Determining auth type for" << _account->davUrl(); QNetworkRequest req; // Prevent HttpCredentialsAccessManager from setting an Authorization header. req.setAttribute(HttpCredentials::DontAddCredentialsAttribute, true); // Don't reuse previous auth credentials req.setAttribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Manual); // Don't send cookies, we can't determine the auth type if we're logged in req.setAttribute(QNetworkRequest::CookieLoadControlAttribute, QNetworkRequest::Manual); auto propfind = _account->sendRequest("PROPFIND", _account->davUrl(), req); propfind->setTimeout(30 * 1000); propfind->setIgnoreCredentialFailure(true); connect(propfind, &SimpleNetworkJob::finishedSignal, this, [this](QNetworkReply *reply) { auto authChallenge = reply->rawHeader("WWW-Authenticate").toLower(); auto result = Basic; if (authChallenge.contains("bearer ")) { result = OAuth; } else if (authChallenge.isEmpty()) { qCWarning(lcDetermineAuthTypeJob) << "Did not receive WWW-Authenticate reply to auth-test PROPFIND"; } qCInfo(lcDetermineAuthTypeJob) << "Auth type for" << _account->davUrl() << "is" << result; emit this->authType(result); this->deleteLater(); }); }
void DetermineAuthTypeJob::start() { qCInfo(lcDetermineAuthTypeJob) << "Determining auth type for" << _account->davUrl(); QNetworkRequest req; // Prevent HttpCredentialsAccessManager from setting an Authorization header. req.setAttribute(HttpCredentials::DontAddCredentialsAttribute, true); // Don't reuse previous auth credentials req.setAttribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Manual); // Don't send cookies, we can't determine the auth type if we're logged in req.setAttribute(QNetworkRequest::CookieLoadControlAttribute, QNetworkRequest::Manual); // Start two parallel requests, one determines whether it's a shib server // and the other checks the HTTP auth method. auto get = _account->sendRequest("GET", _account->davUrl(), req); auto propfind = _account->sendRequest("PROPFIND", _account->davUrl(), req); get->setTimeout(30 * 1000); propfind->setTimeout(30 * 1000); get->setIgnoreCredentialFailure(true); propfind->setIgnoreCredentialFailure(true); connect(get, &AbstractNetworkJob::redirected, this, [this, get](QNetworkReply *, const QUrl &target, int) { #ifndef NO_SHIBBOLETH QRegExp shibbolethyWords("SAML|wayf"); shibbolethyWords.setCaseSensitivity(Qt::CaseInsensitive); if (target.toString().contains(shibbolethyWords)) { _resultGet = Shibboleth; get->setFollowRedirects(false); } #endif }); connect(get, &SimpleNetworkJob::finishedSignal, this, [this]() { _getDone = true; checkBothDone(); }); connect(propfind, &SimpleNetworkJob::finishedSignal, this, [this](QNetworkReply *reply) { 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"; } _propfindDone = true; checkBothDone(); }); }
CheckServerJob::CheckServerJob(Account *account, bool followRedirect, QObject *parent) : AbstractNetworkJob(account, QLatin1String(statusphpC) , parent) , _followRedirects(followRedirect) , _subdirFallback(false) , _redirectCount(0) { setIgnoreCredentialFailure(true); }
CheckServerJob::CheckServerJob(AccountPtr account, QObject *parent) : AbstractNetworkJob(account, QLatin1String(statusphpC), parent) , _subdirFallback(false) , _permanentRedirects(0) { setIgnoreCredentialFailure(true); connect(this, &AbstractNetworkJob::redirected, this, &CheckServerJob::slotRedirected); }
ThumbnailJob::ThumbnailJob(const QString &path, AccountPtr account, QObject* parent) : AbstractNetworkJob(account, QLatin1String("index.php/apps/files/api/v1/thumbnail/150/150/") + path, parent) { setIgnoreCredentialFailure(true); }
OcsJob::OcsJob(AccountPtr account) : AbstractNetworkJob(account, "") { _passStatusCodes.append(OCS_SUCCESS_STATUS_CODE); setIgnoreCredentialFailure(true); }
ShibbolethUserJob::ShibbolethUserJob(Account* account, QObject* parent) : AbstractNetworkJob(account, QLatin1String("ocs/v1.php/cloud/user"), parent) { setIgnoreCredentialFailure(true); }