diff --git a/ssuurlresolver/ssuurlresolver.cpp b/ssuurlresolver/ssuurlresolver.cpp index 7699829..2ee4455 100644 --- a/ssuurlresolver/ssuurlresolver.cpp +++ b/ssuurlresolver/ssuurlresolver.cpp @@ -128,28 +128,27 @@ void SsuUrlResolver::run(){ // resolve base url resolvedUrl = ssu.repoUrl(repo, isRnd, repoParameters); + QString credentialsScope = ssu.credentialsScope(repo, isRnd); // only do credentials magic on secure connections - if (resolvedUrl.startsWith("https://") && ssu.isRegistered()){ + if (resolvedUrl.startsWith("https://") && !credentialsScope.isEmpty() && + (ssu.isRegistered() || credentialsScope == "store")){ // TODO: check for credentials scope required for repository; check if the file exists; // compare with configuration, and dump credentials to file if necessary ssuLog->print(LOG_DEBUG, QString("Requesting credentials for '%1' with RND status %2...").arg(repo).arg(isRnd)); - QString credentialsScope = ssu.credentialsScope(repo, isRnd); - if (!credentialsScope.isEmpty()){ - // personal store repositories as well as the ones listed in the - // store-auth-repos domain setting use store credentials. Refresh - // here, as we only know after checking scope if we need to have - // store credentials at all - if (credentialsScope == "store"){ - ssu.updateStoreCredentials(); - if (ssu.error()) - error (ssu.lastError()); - } - headerList.append(QString("credentials=%1").arg(credentialsScope)); - writeZyppCredentialsIfNeeded(credentialsScope); - } else - ssuLog->print(LOG_DEBUG, "Skipping credential update due to missing credentials scope"); - } + // personal store repositories as well as the ones listed in the + // store-auth-repos domain setting use store credentials. Refresh + // here, as we only know after checking scope if we need to have + // store credentials at all + if (credentialsScope == "store"){ + ssu.updateStoreCredentials(); + if (ssu.error()) + error (ssu.lastError()); + } + headerList.append(QString("credentials=%1").arg(credentialsScope)); + writeZyppCredentialsIfNeeded(credentialsScope); + } else + ssuLog->print(LOG_DEBUG, QString("Skipping credential for %1 with scope %2").arg(repo).arg(credentialsScope)); if (!headerList.isEmpty() && !resolvedUrl.isEmpty()){ resolvedUrl = QString("%1?%2")