从Visual Studio中对Artifactory上的NuGet进行身份验证

时间:2014-01-09 11:35:41

标签: visual-studio ldap nuget visual-studio-2013 artifactory

我们有一个本地Artifactory Pro服务器,它服务于nuget包,并使用LDAP对所有用户进行身份验证。使用cmdline中的Artifactory-NuGet可以很好地工作,但是当尝试使用Visual Studio中的包管理器时,身份验证失败。

我注意到Visual Studio尝试在第一次失败的身份验证尝试后添加域前缀:尝试以'user'身份登录失败,然后登录身份验证窗口包含'DOMAIN \ user'作为用户名。

我不确定问题的根源是在Visual Studio中还是在Artifactory中。我注意到对Artifactory的Web访问不接受“DOMAIN \ user”形式的用户名,即使我觉得它应该。

所以我的问题是:如何在Visual Studio中对LDAP支持的Artifactory提供的经过身份验证的NuGet服务器进行身份验证?

2 个答案:

答案 0 :(得分:3)

确保您输入了用户名(LDAP用户名)和加密密码,即artifactory webapp

可以获得的密码

答案 1 :(得分:1)

我有同样的问题,但我可以通过NuGet命令行的浏览器下载。

我用fiddler查看了不同的流量,看来VS在验证后没有添加安全令牌。当我使用浏览器下载时,流量会在身份验证后显示一个额外的cookie,这在VS请求中不存在。

Browser
Request = https://server/repo/artifact.pkg
Responce = 401 not authrised
{user prompted for username and password}
Request = http TUNNEL encryped basic login
Responce = 200 encrypted security token
Request = https://server/repo/artifact.pkg + security token
Responce = 200 the pkg file


Visual studio
Request = https://server/repo/$metadata
Responce = 401 not authrised
{user prompted for username and password}
Request = http TUNNEL encryped basic login
Responce = 200 encrypted security token
Request = https://server/repo/$metadata + security token
Responce = 200 <edmx> list of artifacts
Request = https://server/repo/artifact.pkg
Responce = 401 not authrised
{user prompted for username and password}
Request = http TUNNEL encryped basic login
Responce = 200 encrypted security token
Request = https://server/repo/artifact.pkg
Responce = 301 its moved to "https://server/repo/artifact.pkg"

看起来VS已损坏,并且cookie未在后续请求中存储和发送。它可能在Windows窗体中使用非常可怕的浏览器组件,而不是在请求之间保留cookie容器。可能想向MS报告。