1

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?

Vartlok
  • 2,539
  • 3
  • 32
  • 46
  • You could use http.proxy and http.proxyport as environment settings or pass them as command line parameter using -D. I believe that will work. – Kanishk Panwar Sep 11 '15 at 12:00

1 Answers1

4

There are two ways support proxy for Java.

  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

  2. 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.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43