要传递给 Java 应用程序以使用 http 代理进行身份验证的 Java 属性 [英] What Java properties to pass to a Java app to authenticate with a http proxy

查看:26
本文介绍了要传递给 Java 应用程序以使用 http 代理进行身份验证的 Java 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Java 应用程序,它试图通过 http 代理访问 Web 服务.Java 应用是第 3 方应用,我们无权访问其源代码.

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.

这篇关于要传递给 Java 应用程序以使用 http 代理进行身份验证的 Java 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆