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?
1 Answers
There are two ways support proxy for Java.
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
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");
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.
Best Regards.

- 23,476
- 4
- 25
- 43