V3 install/restore only uses credentials for index.json #1300

Closed
jmyersmsft opened this Issue Aug 31, 2015 · 1 comment

Projects

None yet

4 participants

@jmyersmsft

We're still having problems with auth against v3 endpoints. Using:

  • nuget.exe built from current dev branch or CI build 10477
  • an authenticated v3 source containing the package 'SuperHelloLib'
  • credentials stored in nuget.config,

running:

nuget install SuperHelloLib

gives the following behavior:

  1. GET (index.json) (without credentials) -> 401 with auth challenge
  2. GET (index.json) (with Basic credentials) -> 200
  3. GET (Registration URL for SuperHelloLib) (without credentials) -> 401 with auth challenge
  4. NuGet.exe gives up with the message "Failed to retrieve metadata from source: '[query URL]'.". No further HTTP requests are issued.

The same behavior is seen with restore using a packages.config

@yishaigalatzer yishaigalatzer added this to the 3.2.0-commandline milestone Aug 31, 2015
@yishaigalatzer

This should be verified both for command line, and visual studio extension

@feiling feiling added a commit to NuGetArchive/NuGet.PackageManagement that referenced this issue Aug 31, 2015
@feiling feiling Unit test for the fix of NuGet/Home#1300. 19aacf8
@feiling feiling added a commit to NuGetArchive/NuGet3 that closed this issue Sep 1, 2015
@feiling feiling Fix NuGet/Home#1300: V3 install/restore only uses credentials for ind…
…ex.json.

The problem is that in HttpHandlerResourceV3Provider, when there is a credential saved in
nuget.config, the code createsCredentialCache, then adds NetworkCredential into the cache, with the
uri of the source as key. However, forV3 source, other resources most likely have different URIs
from index.json endpoint. Thus, this CredentialCache won't be able to provide credentials for other
resources. It only works for index.json.

The fix is to just create a normal NetworkCredential object.
a7c1294
@feiling feiling added a commit to NuGetArchive/NuGet.PackageManagement that referenced this issue Sep 1, 2015
@feiling feiling Unit test for the fix of NuGet/Home#1300. 705c9de
@RanjiniM RanjiniM added the 2 - Working label Sep 1, 2015
@zhili1208 zhili1208 was assigned by RanjiniM Sep 1, 2015
@zhili1208 zhili1208 added 3 - Done and removed 2 - Working labels Sep 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment