Set<RemoteRepository> enrichedRepos = new HashSet<>();
LazyAuthenticationSelector authSelector = createAuthSelector(settings, mirrorSelector);
for (RemoteRepository settingsRepo : settingsRepos)
{
// Obtain the Authentication for the repository or it's mirror
Authentication auth = authSelector.getAuthentication(settingsRepo);
// All RemoteRepositories (Mirrors and Repositories) constructed so far lack Authentication info.
// Use the settings repo as the prototype and create an enriched repo with the Authentication.
enrichedRepos.add(new RemoteRepository.Builder(settingsRepo).setAuthentication(auth).build());
}
return new ArrayList<>(enrichedRepos);