Menu

Authenticating Web Proxy

2003-08-15
2003-11-12
  • John Lonergan

    John Lonergan - 2003-08-15

    We have wc.setProxyServer( "server", port );

    But how do we supply the uid/pwd credentials to the webproxy ?

     
    • Anonymous

      Anonymous - 2003-11-12

      WebConversation context = new WebConversation();

      String pwd = "proxy_username") + ":" + "proxy_password";
      BASE64Encoder B64Encoder = new BASE64Encoder();
      String encodedPassword = B64Encoder.encode(pwd.getBytes());

      Properties systemProperties = System.getProperties();
      systemProperties.setProperty("proxySet", "true");
      systemProperties.setProperty("proxyHost", "your_proxy_name");
      systemProperties.setProperty("proxyPort", "your_proxy_port");
      System.setProperties(systemProperties);

      try{
        context.setHeaderField("Proxy-Authorization", "Basic"+encodedPassword);
      }
      catch(Exception e){
          e.printStackTrace();
      }

       

Log in to post a comment.

Auth0 Logo