public List<RepositoryInfo> getRepositories(String credentials) {
    List<RepositoryInfo> repos = new ArrayList<>();

    for (RepositoryXml.Os o : getOses()) {
      String osFamily = o.getFamily();
      for (String os : osFamily.split(",")) {
        for (RepositoryXml.Repo r : o.getRepos()) {

          RepositoryInfo ri = new RepositoryInfo();
          String baseUrl = r.getBaseUrl();

          // add credentials from VDF url to baseurl.
          if (!Strings.isNullOrEmpty(credentials)) {
            Matcher matcher = HTTP_URL_PROTOCOL_PATTERN.matcher(baseUrl);
            baseUrl = matcher.replaceAll("$1" + credentials + "@");
          }

          ri.setBaseUrl(baseUrl);
          ri.setDefaultBaseUrl(r.getBaseUrl());
          ri.setMirrorsList(r.getMirrorsList());
          ri.setOsType(os.trim());
          ri.setRepoId(r.getRepoId());
          ri.setRepoName(r.getRepoName());
          ri.setDistribution(r.getDistribution());
          ri.setComponents(r.getComponents());
          ri.setUnique(r.isUnique());
          ri.setTags(r.tags);

          repos.add(ri);
        }
      }
    }

    return repos;
  }
@param credentials string with column separated username and password to be inserted in basurl.
                   If set to null baseurl is not changed.

@return the list of repositories consumable by the web service.
ambari-server/src/main/java/org/apache/ambari/server/state/stack/RepositoryXml.java