我试图通过我们的公司代理呼叫休息服务,但不断收到回复:
407 Proxy Authentication Required. Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.
任何人都可以提出我可以尝试的其他任何建议,或者是支持NTLM的RestAssured的替代方案吗?
这是我目前的代码:
PreemptiveBasicAuthScheme auth = new PreemptiveBasicAuthScheme();
auth.setUserName("my username");
auth.setPassword("my password");
// was getting desperate so tried adding this
System.setProperty("http.proxyHost", "XXXX");
System.setProperty("http.proxyPort", "8080");
System.setProperty("http.proxyUser", "my username");
System.setProperty("http.proxyPassword", "my password");
System.setProperty("https.proxyHost", "XXXX");
System.setProperty("https.proxyPort", "8080");
System.setProperty("https.proxyUser", "my username");
System.setProperty("https.proxyPassword", "my password");
Response r = RestAssured
.given()
// tried with and without this
.header("Proxy-Authorization", auth.generateAuthToken())
.proxy("XXXX", 8080)
.get(fullPath, key, key);
答案 0 :(得分:0)
这里有几个问题 - 第一个我已经排序,第二个我仍然被阻止。
设置代理身份验证只需设置正确的标头(如许多其他帖子中所述):
.header("Proxy-Authorization", auth.generateAuthToken())
阻止我的是我正在调用运行在https上的服务而不是http,而代理似乎没有被使用......所以回到绘图板。