Commit beef0d92 authored by Marko Saukko's avatar Marko Saukko

Allow defining url domains to be used with specific credentials.

[ssu] Allow defining url domain to be used with specific credentials. Fixes JB#32346

Previously store-auth-repos could be only defined in repos.ini and each
new feature would need to add new line to that variable. This patch
allows repos.ini to define url domain,credential pairs that can be used
to say which credential is used when certain url domain is used.

This removes the need to touch repos.ini when bringing in new feature.
Signed-off-by: default avatarMarko Saukko <marko.saukko@jolla.com>
parent 53a40e23
......@@ -98,6 +98,7 @@ QString Ssu::credentialsScope(QString repoName, bool rndRepo){
SsuVariables::variable(&repoSettings,
domain() + "-domain",
storeAuthReposKey).toStringList();
if (storeAuthRepos.empty())
storeAuthRepos =
SsuVariables::variable(&repoSettings,
......@@ -107,6 +108,18 @@ QString Ssu::credentialsScope(QString repoName, bool rndRepo){
if (storeAuthRepos.contains(repoName))
return "store";
// If we defined explicitly what credentials to use with which secure domain
// use those.
QHash<QString, QString> secureDomainAuth;
SsuVariables::variableSection(&repoSettings, "secure-domain-auth", &secureDomainAuth);
QHashIterator<QString, QString> i(secureDomainAuth);
while (i.hasNext()) {
i.next();
if (repoUrl(repoName, rndRepo).contains(i.key()) && !i.value().isEmpty()) {
return i.value();
}
}
return settings->credentialsScope(repoName, rndRepo);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment