更新时间:2021-12-16 07:41:59
我们在这里做了同样的事情来验证基于NTLM的代理。
We did the same here for authenticating on a NTLM based proxy.
代理上的身份验证实际上是正常的 HTTP基本身份验证。
The authentication on the proxy is actually a normal HTTP Basic Authentication.
我们使用以下方法:
protected URLConnection newURLConnection(URL pURL) throws IOException {
URLConnection urlConnection = super.newURLConnection(pURL);
String auth = new String(Base64.base64Encode(new String("username:password").getBytes()));
auth = "Basic " + auth;
urlConnection.setRequestProperty("Proxy-Connection","Keep-Alive");
urlConnection.setRequestProperty("Proxy-Authorization",auth);
return urlConnection;
}
这与代理jvm设置一起完成了这个伎俩。
That, together with the proxy jvm settings, did the trick.
请参阅 http://en.wikipedia.org/wiki/ Basic_access_authentication 。