static IPackageRepository InjectAuthentication(IPackageRepository remote, RemoteRepositoryEndpoint config) { if (config.Username == null) { return(remote); } var auth = remote.Feature <ISupportAuthentication>(); if (auth == null) { return(remote); } return(new PreAuthenticatedRepository(remote, auth, new NetworkCredential(config.Username, config.Password))); }
RemoteEndpointData BuildEndpointData(RemoteRepositoryEndpoint value, string type) { var repo = Repo(value.Token); return(new RemoteEndpointData(repo.Name, type, repo.Type, value.Token, value.Username, value.Password)); }