如何使用验证代理为Visual Studio代码指定用户标识和密码?

问题描述:

如何使用验证代理为Visual Studio代码指定用户标识和密码?如何使用验证代理为Visual Studio代码指定用户标识和密码?

我看到主VS代码的网站上的Proxy Server Support,但只提到两个设置...

"http.proxy": "http://10.203.0.1:5187/" 
"http.proxyStrictSSL": false 

我已经设置这些,但仍没有运气,例如我不能安装扩展......甚至不能让他们的名单

我怀疑这是我们的代理,因为它需要用户名和密码:-(

所以你怎么能设置这些值?

+2

下面的答案不起作用了。相反,他们引入了一个名为“http.proxyAuthorization”的新配置参数,但这不起作用。拒绝设置不安全标题“代理授权”。它已经报道:https://github.com/Microsoft/vscode/issues/17502 – mono68

+0

报告并不意味着固定...甚至承认。超过4个月后仍在等待修复。 –

代理URL里面的一组凭据:

http://username:[email protected]:5187/ 
+0

优秀的,工作的待遇...现在为什么他们没有在文档中:-( – SteveC

+0

@SteveC我想,因为这是一个基本的访问身份验证的标准程序,名为url编码,但你可以让他们的建议将其包含在文档中 https://en.wikipedia.org/wiki/Basic_access_authentication – Oscar

+3

不再有效 –

如果你不想保存在设置文件的凭据,小提琴手可用于代理调用代理。此外,我相信。以上仅适用于使用基本身份验证的代理服务器,下面应该介绍一下rk for NTLM。

VSCode打开设置文件:

%APPDATA%\代码\用户\ settings.json

添加以下内容:

{ 
    "http.proxy": "http://127.0.0.1:8888", 
    "http.proxyStrictSSL": false 
} 

提琴手确认提琴手设置:

enter image description here enter image description here

提琴手确保提琴手设置为自动认证:

enter image description here

VSCode扩展现在应该是联机的:

enter image description here


更新

这是现在不再需要执行如下的PR #22369这是在1.15 Proxy server authentication版本中实现。

在我来说,我仍然需要补充:

"http.proxyStrictSSL": false 
+1

我使用了fiddler,但需要使用Customize Rules ... OnBeginRequest“if(m_AutoAuth){oSession [”X- AutoAuth“] =”domain \\ username:password“;}” – Coding101

+0

这会很好,如果vs代码提供了一个设置来指定像npm这样的ca,所以我们不必将strictssl设置为false。 github [这里](https://github.com/Microsoft/vscode/issues/9790?_pjax=%23js-repo-pjax-container) – martinoss

“http.proxy”: “http://DOMAIN//USER:[email protected]:8080”。 不要忘记添加端口。

我最喜欢的回答是David Martin对使用Fiddler的建议。但是,如果这不是你想要进行的,下面是如何为代理设置你的凭证。

要指定域+用户名+密码(这可能不是以斜杠工作,所以在斜杠的地方使用%5C如下图所示)

// The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables 
"http.proxy": "http://DOMAIN%5Cusername:[email protected]_name_or_ip:port", 
"https.proxy": "http://DOMAIN%5Cusername:[email protected]_name_or_ip:port", 

// Whether the proxy server certificate should be verified against the list of supplied CAs. 
"http.proxyStrictSSL": false, 

要指定只是用户名+密码:

// The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables 
"http.proxy": "http://username:[email protected]_name_or_ip:port", 
"https.proxy": "http://username:[email protected]_name_or_ip:port", 

// Whether the proxy server certificate should be verified against the list of supplied CAs. 
"http.proxyStrictSSL": false, 
+0

我用过这个但还是不行。是否还有其他的东西? –

+0

男人,你救了我!我在字符串中使用了“\\”而不是“%5C”。只要我用“%5C”替换了反斜杠,一切都奏效了!非常感谢! :) – JohnyL

请参考这篇文章。 https://taeguk.co.uk/blog/working-in-visual-studio-behind-the-firewall/

我们假设我的NTLM登录名是DOMAIN \ User Name,密码是P @ ssword! 凭证的格式需要为DOMAIN \ User Name:P @ ssword !,但您需要URL编码用户名和密码。 简单的在线URL编码可以将您的用户名和密码转换为:DOMAIN%5CUser%20Name和P%40ssword !. 片所有这些信息到像一个字符串这样:http://DOMAIN%5CUser%20Name:P%[email protected]:8881 然后在文件添加到您的用户设置这一点,反对“http.proxy”价值偏好: //将设置在这个文件覆盖默认设置 { “http.proxy”:“http://DOMAIN%5CUser%20Name:P%[email protected]:8881” }

+0

这对VSCode 1.9.1企业防火墙后的工作。区分因素是URL编码建议。谢谢@ Kiki.J.Hu。 –