ADAL的Java代理 [英] ADAL for Java Proxy

查看:287
本文介绍了ADAL的Java代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过Azure的AD在我的应用程序,并为此我选择adal4j添加验证,因为它的官方图书馆。但我惊讶的是这个库不支持代理(还是我错了?)。因此,确实存在任何解决方法吗?

I'm trying to add authentication through Azure AD in my app and for this purpose I select adal4j, because it's official library. But I surprised that this library doesn't support proxy(or am I wrong?). So, Does exist any workaround?

推荐答案

有两种方式支持代理的Java。

There are two ways support proxy for Java.


  1. 命令行JVM设置:
    代理设置通过命令行参数提供给JVM:

  1. Command Line JVM Settings: The proxy settings are given to the JVM via command line arguments:

Java的-Dhttp.proxyHost = proxyhostURL -Dhttp.proxyPort = proxyPortNumber -Dhttp.proxyUser = someUserName -Dhttp.proxyPassword = somePassword HelloWorldClass

java -Dhttp.proxyHost=proxyhostURL -Dhttp.proxyPort=proxyPortNumber -Dhttp.proxyUser=someUserName -Dhttp.proxyPassword=somePassword HelloWorldClass

在code设置系统属性
添加以下行在Java code,使JVM使用代理进行HTTP调用。这,当然需要你重新编译Java源代码。 (其他方法不需要任何重新编译):

Setting System Properties in Code Add the following lines in your Java code so that JVM uses the proxy to make HTTP calls. This would, of course, require you to recompile your Java source. (The other methods do not require any recompilation):

System.setProperty("http.proxyPort", "someProxyPort");
System.setProperty("http.proxyUser", "someUserName");
System.setProperty("http.proxyPassword", "somePassword");
System.setProperty("http.proxyHost", "someProxyURL");


有关网络与放大器的更多信息;代理和放大器;在Java属性,请参考的http://文档。 oracle.com/javase/7/docs/technotes/guides/net/proxies.html 并的 http://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html

More information for Networking & Proxies & Properties in Java, Please refer to http://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.html and http://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html.

最好的问候。

这篇关于ADAL的Java代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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