要传递给Java应用程序以使用http代理进行身份验证的Java属性
我有一个试图通过http代理访问Web服务的Java应用程序。 Java应用程序是我们无法访问源代码的第三方应用程序。
I have a Java application that is trying to access a web service via http proxy. The Java app is 3rd party app for which we don't have access to source code.
可以通过传递Java启动参数来配置它的启动。
我想知道一个人可以传递的java属性是什么,以便应用程序可以使用登录用户的NTLM凭据来验证代理连接?
Its launch can be configured by passing Java launch parameters among other things. I am wondering what are the java properties that one can pass so that the app can use the logged in user's NTLM credentials to authenticate proxy connections?
当我通过https.proxyHost和https.proxyPort(即-Dhttps.proxyHost = abcd ...到jvm命令行),我确实看到了日志的不同。现在它失败并显示以下消息。
When I passed https.proxyHost and https.proxyPort (i.e. -Dhttps.proxyHost=abcd ... to jvm command line), I do see difference in the logs. Now it fails with message below.
[WrapperSimpleAppMain] [AuthChallengeProcessor] ntlm authentication scheme selected
INFO | jvm 5 | 2015/06/03 14:49:25 | 2015-06-03 14:49:25,380
INFO [WrapperSimpleAppMain] [HttpMethodDirector] No credentials available for NTLM <any realm>@proxy.ins.dell.com:80
INFO | jvm 5 | 2015/06/03 14:49:25 | Exiting due to fatal exception.
INFO | jvm 5 | 2015/06/03 14:49:25 | com.atlassian.bamboo.agent.bootstrap.RemoteAgentHttpException: HTTP status code 407 received in response to fingerprint request
我尝试传递http.proxyUser和http.proxyPassword。那没用。
我想知道正确的配置是什么使Java应用程序透明地使用代理信息而不必更改代码。
I tried passing http.proxyUser and http.proxyPassword. That didn't work. I am wondering what the right configuration is to make a Java app transparently use proxy info without having to make code changes.
谢谢
最后我通过反复试验弄明白了。传递java.net.useSystemProxies = true以及https.proxyPort,https.proxyHost解决了这个问题。
Finally I figured out by trial and error. Passing java.net.useSystemProxies=true along with https.proxyPort, https.proxyHost resolved this.
基本上java vm命令行得到了
Basically the java vm command line got
-Djava.net.useSystemProxies = true -Dhttps.proxyPort = 80 -Dhttps.proxyHost = proxyserver.mycompany.com
我没有通过https.proxyUser,https.proxyPassword。我相信代理身份验证使用与登录NTLM凭据相同的凭据。
I didn't have to pass https.proxyUser, https.proxyPassword. I believe proxy authentication used the same credentials as my login NTLM credentials.