Socks Proxy Authentication

I have working socks proxy with Java Mail 1.4.5 without user name/password but wish to support socks proxies that require user names and passwords.
I have tried using an authenticator on the Session.getInstance(Properties, Authenticator) object but I get an error saying incorrect user name/password on my socks proxy.
My sample code is below:
Properties properties = getProperties();
final String socksProxyUserName = "test";
final String socksProxyPassword = "test";
Authenticator authenticator = new Authenticator() {
     @Override
     protected PasswordAuthentication getPasswordAuthentication() {
          PasswordAuthentication passwordAuthentication = new PasswordAuthentication(socksProxyUserName, socksProxyPassword);
          return passwordAuthentication;
Session session = Session.getInstance(properties, authenticator);
My socks proxy is FreeProxy.
I am using this method for socks proxy support in java mail.
If your proxy server supports the SOCKS V4 or V5 protocol (http://www.socks.nec.com/aboutsocks.html, RFC1928) and allows anonymous connections, and you're using JDK 1.5 or newer and JavaMail 1.4.5 or newer, you can configure a SOCKS proxy on a per-session, per-protocol basis by setting the "mail.smtp.socks.host" property as described in the javadocs for the com.sun.mail.smtp package. Similar properties exist for the "imap" and "pop3" protocols.
Message in Proxy logfile is:
Fri 20 Jul 2012 09:37:59 : ACCESS : Instance:'socky' Protocol:'SOCKS-5-Proxy' Access:'Forbidden' Client IP:'10.45.16.21' User:'test/FPDOMAIN' Resource Type:'User Authentication' Resource:'Authentication: User/password invalid'
I have confirmed user name and password several times and tried extra ones just in case but no luck.
Does anybody have any ideas. THe fact that it tries to authenticate the login on my proxy server suggests I'm trying the correct method to connect to me but can someone confirm this for me?
This proxy has this user added as I set it up myself.
Edited by: 947715 on 20-Jul-2012 01:15
Edited by: 947715 on 20-Jul-2012 01:16
Edited by: 947715 on 20-Jul-2012 01:40
Edited by: 947715 on 20-Jul-2012 03:10

I got it working now using the below:
final String socksProxyUserName = configurationService.getString(IParameterConstants.SOCKS_PROXY_USERNAME);
final String socksProxyPassword = configurationService.getString(IParameterConstants.SOCKS_PROXY_PASSWORD);
if (!socksProxyUserName.equals(EMPTY_STRING)) {
     java.net.Authenticator authenticator = new java.net.Authenticator() {
@Override
     protected java.net.PasswordAuthentication getPasswordAuthentication() {
          return new java.net.PasswordAuthentication(socksProxyUserName, socksProxyPassword.toCharArray());
     System.setProperty("java.net.socks.username", socksProxyUserName); //$NON-NLS-1$
     System.setProperty("java.net.socks.password", socksProxyPassword); //$NON-NLS-1$
     java.net.Authenticator.setDefault(authenticator);
}

Similar Messages

  • How to disable SOCKS Proxy Authentication

    Hello,
    Using j2sdk1.4.2_03 I want to connect to a SOCKS 4 proxy but I have some authentication problems.
    I am setting the following:
    Properties props = System.getProperties();
    props.put("socksProxyPort", port);
    props.put("socksProxyHost", host);
    System.setProperties(props);
    In the proxy logs I can see that I am trying to make a connection as I authenticated user. The JVM sends as default the current system user, which I don't want.
    I can change the default user, setting the default Authenticator:
    java.net.Authenticator.setDefault(new Authenticator() {
    protected PasswordAuthentication getPasswordAuthentication() {
    return new PasswordAuthentication("dummy", "dummy".toCharArray());
    If I set java.net.Authenticator.setDefault(null) then the default Authenticator is used and the current user is sent to the proxy. Is there a way to disable the default SOCKS authentication?
    It seems that the JVM connects me in a SOCKS 5 way, because of this authentication...
    Does any one can help?
    Thanks in advance,
    mac

    I've installed now Ethereal, a network package filter, and it's clear now that JVM uses as default SOCKS 5...
    Does anyone knows why and how can I switch to SOCKS 4?
    mac

  • Authenticating to Socks proxy using different accounts in a given JVM

    I have a J2EE application that runs some background jobs. Each of these background jobs need to connect to an external FTP server. However, all connections must go through a central SOCKS proxy server. The SOCKS proxy server is set up to require authentication using user names and passwords. Everything works fine if I've to use this SOCKS proxy with "a set" of credentials across all background jobs. However, if I want Job1 to use "user1" for SOCKS login, and Job2 to use "user2" for SOCKS login, I can't seem to find a way to do this. I need this functionality for accounting purposes. Any help on how this can be accomplished is greatly appreciated.
    Regards,
    Sai Pullabhotla

    I tried implementing the ThreadLocal idea and I think the code is working as expected, but my proxy logs are not matching up with what the code says. Below is the code I've including a test class. See below the code for my additional comments.
    import java.net.Authenticator;
    import java.net.PasswordAuthentication;
    * A customer authenticator for authenticating with SOCKS Proxy servers.
    public class ProxyAuthenticator extends Authenticator {
          * A thread local for storing the credentials to the SOCKS proxy. The Javadoc
          * for ThreadLocal says they are typically used for static fields, but
          * here I've a singleton instance. Hope this is not an issue.
         private ThreadLocal<PasswordAuthentication> credentials = null;
          * Singleton instance.
         private static ProxyAuthenticator instance = null;
          * Creates a new instance of <code>ProxyAuthenticator</code>. Each thread
          * will have its own copy of credentials, which would be <code>null</code>
          * initially. Each thread must call the <code>setCredentials</code> method
          * to set the proxy credentials if needed.
         private ProxyAuthenticator() {
              credentials = new ThreadLocal<PasswordAuthentication>() {
                   @Override
                   protected PasswordAuthentication initialValue() {
                        System.out.println("ThreadLocal initialized for "
                             + Thread.currentThread().getName());
                        return null;
                   @Override
                   public void set(PasswordAuthentication value) {
                        System.out.println(Thread.currentThread().getName() + " SET");
                        super.set(value);
                   @Override
                   public PasswordAuthentication get() {
                        System.out.println(Thread.currentThread().getName() + " GET");
                        return super.get();
          * Returns the singleton instance of this class.
          * @return the singleton instance of this class.
         public static synchronized ProxyAuthenticator getInstance() {
              if (instance == null) {
                   instance = new ProxyAuthenticator();
              return instance;
          * Sets the proxy creditials. This method updates the ThreadLocal variable.
          * @param user
          *            the user name
          * @param password
          *            the password
         public void setCredentials(String user, String password) {
              credentials.set(new PasswordAuthentication(user, password.toCharArray()));
         @Override
         public PasswordAuthentication getPasswordAuthentication() {
              System.out.println("Requesting host: " + this.getRequestingHost());
              System.out.println("Requesting port: " + this.getRequestingPort());
              System.out.println("Requesting protocol: "
                   + this.getRequestingProtocol());
              System.out.println("Requesting prompt: " + this.getRequestingPrompt());
              System.out.println("Requesting scheme: " + this.getRequestingScheme());
              System.out.println("Requesting site: " + this.getRequestingSite());
              System.out.println("Requesting URL: " + this.getRequestingURL());
              System.out.println("Requestor type: " + this.getRequestorType());
              System.out.println(Thread.currentThread().getName()
                   + " Authenitcator returning credentials "
                   + credentials.get().getUserName() + ":"
                   + new String(credentials.get().getPassword()));
              return credentials.get();
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.net.Authenticator;
    import java.net.InetSocketAddress;
    import java.net.Proxy;
    import java.net.Socket;
    import java.net.Proxy.Type;
    * A test class for testing the {@link ProxyAuthenticator}.
    public class SocksProxyTest implements Runnable {
          * Socks proxy host, used by the FakeFtpClient
         private static final String SOCKS_PROXY_HOST = "192.168.1.240";
          * Target FTP host to connect to
         private String host = null;
          * Proxy user
         private String proxyUser = null;
          * Proxy password
         private String proxyPassword = null;
          * Creates a new instance of <code>SocksProxyTest</code>
          * @param host
          *            the target FTP host
          * @param proxyUser
          *            proxy user
          * @param proxyPassword
          *            proxy password
         public SocksProxyTest(String host, String proxyUser, String proxyPassword) {
              this.host = host;
              this.proxyUser = proxyUser;
              this.proxyPassword = proxyPassword;
         public void run() {
              // Create the FakeFtpClient
              FakeFtpClient test = new FakeFtpClient(host, 21, proxyUser,
                   proxyPassword);
              for (int j = 0; j < 5; j++) {
                   try {
                        test.connect();
                        test.disconnect();
                        // Thread.sleep(10000);
                   catch (Throwable t) {
                        t.printStackTrace();
          * Test run.
          * @param args
          *            command line arguments
          * @throws IOException
          *             propagated
         public static void main(String[] args) throws IOException {
              // Get the singleton instance of the ProxyAuthenticator.
              ProxyAuthenticator authenticator = ProxyAuthenticator.getInstance();
              // Update the default authenticator to our ProxyAuthenticator
              Authenticator.setDefault(authenticator);
              // Array of FTP hosts we want to connect to
              final String[] ftpHosts = { "192.168.1.53", "192.168.1.54",
                        "192.168.1.55" };
              // Proxy login/user names to connect to each of the above hosts
              final String[] users = { "User-001", "User-002", "User-003" };
              // Proxy passwords for each of the above user names (in this case
              // password == username).
              final String[] passwords = users;
              // For each target FTP host
              for (int i = 0; i < 3; i++) {
                   // Create the SocksProxyTest instance with the target host, proxy
                   // user and proxy password
                   SocksProxyTest spt = new SocksProxyTest(ftpHosts, users[i],
                        passwords[i]);
                   // Create a new thread and start it
                   Thread t = new Thread(spt);
                   t.setName("T" + (i + 1));
                   try {
                        t.join();
                   catch (InterruptedException e) {
                        e.printStackTrace();
                   t.start();
         * A fake FTP client. The connect method connects to the given host, reads
         * the first line the server sends. Does nothing else. The disconnect method
         * closes the socket.
         private static class FakeFtpClient {
              * The FTP host
              private String host = null;
              * The FTP port
              private int port = 0;
              * Proxy login/user name
              private String proxyUser = null;
              * Proxy password
              private String proxyPassword = null;
              * Socket to the target host
              private Socket s = null;
              * Creates a new instance of <code>FakeFtpClient</code>
              * @param host
              * the FTP host
              * @param port
              * the FTP port
              * @param proxyUser
              * Proxy user
              * @param proxyPassword
              * Proxy password
              public FakeFtpClient(String host, int port, String proxyUser,
                   String proxyPassword) {
                   this.host = host;
                   this.port = port;
                   this.proxyUser = proxyUser;
                   this.proxyPassword = proxyPassword;
              * Connects to the target FTP host through the specified Socks proxy and
              * proxy authentication. Reads the first line of the welcome message.
              * @throws IOException
              * propagated
              public void connect() throws IOException {
                   System.out.println(Thread.currentThread().getName()
                        + " Connecting to " + host + " ...");
                   // Update the ProxyAuthenticator with the correct credentials for
                   // this thread
                   ProxyAuthenticator.getInstance().setCredentials(proxyUser,
                        proxyPassword);
                   s = new Socket(new Proxy(Type.SOCKS, new InetSocketAddress(
                        SOCKS_PROXY_HOST, 1080)));
                   s.setSoTimeout(10000);
                   s.connect(new InetSocketAddress(host, port), 10000);
                   System.out.println(Thread.currentThread().getName() + " Connected");
                   BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
                        s.getOutputStream()));
                   BufferedReader reader = new BufferedReader(new InputStreamReader(
                        s.getInputStream()));
                   System.out.println(reader.readLine());
              * Closes the socket.
              public void disconnect() {
                   System.out.println(Thread.currentThread().getName()
                        + " Disconnecting...");
                   if (s != null) {
                        try {
                             s.close();
                             System.out.println(Thread.currentThread().getName()
                                  + " Disconnected");
                        catch (IOException e) {
                             e.printStackTrace();
    Looking at the test class, it creates 3 threads T1, T2 and T3. T1 is setup to connect to 192.168.1.53 using a proxy user User-001 and T2 is setup to connect to 192.168.1.54 using proxy user User-002 and T3 connects to 192.168.1.55 using proxy user User-003.
    Each thread then loops 5 times to connect to their target servers and disconnect each time. All the debug (System.out) statements indicate that the getPasswordAuthentication is returning the correct credentials for each thread. However, when I look at the logs on the proxy server, the results are different and arbitrary.
    Below is the proxy log:
    [2011-01-24 11:10:11] 192.168.1.240 User-001 SOCKS5 CONNECT 192.168.1.54:21
    [2011-01-24 11:10:11] 192.168.1.240 User-002 SOCKS5 CONNECT 192.168.1.53:21
    [2011-01-24 11:10:11] 192.168.1.240 User-002 SOCKS5 CONNECT 192.168.1.55:21
    [2011-01-24 11:10:11] 192.168.1.240 User-003 SOCKS5 CONNECT 192.168.1.55:21
    [2011-01-24 11:10:11] 192.168.1.240 User-003 SOCKS5 CONNECT 192.168.1.55:21
    [2011-01-24 11:10:11] 192.168.1.240 User-003 SOCKS5 CONNECT 192.168.1.55:21
    [2011-01-24 11:10:11] 192.168.1.240 User-003 SOCKS5 CONNECT 192.168.1.55:21
    [2011-01-24 11:10:11] 192.168.1.240 User-003 SOCKS5 CONNECT 192.168.1.54:21
    [2011-01-24 11:10:11] 192.168.1.240 User-002 SOCKS5 CONNECT 192.168.1.53:21
    [2011-01-24 11:10:12] 192.168.1.240 User-001 SOCKS5 CONNECT 192.168.1.54:21
    [2011-01-24 11:10:12] 192.168.1.240 User-002 SOCKS5 CONNECT 192.168.1.53:21
    [2011-01-24 11:10:12] 192.168.1.240 User-001 SOCKS5 CONNECT 192.168.1.54:21
    [2011-01-24 11:10:12] 192.168.1.240 User-002 SOCKS5 CONNECT 192.168.1.53:21
    [2011-01-24 11:10:12] 192.168.1.240 User-001 SOCKS5 CONNECT 192.168.1.54:21
    [2011-01-24 11:10:13] 192.168.1.240 User-002 SOCKS5 CONNECT 192.168.1.53:21
    As you can see from the first line in the log, the proxy says User-001 connected to 192.168.1.54, but the code should always connect to 192.168.1.53 with user User-001.
    Any idea on what might be going on?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Bug? Socks Proxy not taking effect for SocketChannel

    I find there's something not working when setting socks proxy in my java application.
    In java api there's such introduction about socks proxy setting:
    (from http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html)
    SOCKS protocol support settings
    The SOCKS username and password are acquired in the following way. First, if the application has registered a java.net.Authenticator default instance, then this will be queried with the protocol set to the string "SOCKS5", and the prompt set to to the string "SOCKS authentication". If the authenticator does not return a username/password or if no authenticator is registered then the system checks for the user preferences "java.net.socks.username" and "java.net.socks.password". If these preferences do not exist, then the system property "user.name" is checked for a username. In this case, no password is supplied.
    socksProxyHost
    socksProxyPort (default: 1080)
    Indicates the name of the SOCKS proxy server and the port number that will be used by the SOCKS protocol layer. If socksProxyHost is specified then all TCP sockets will use the SOCKS proxy server to establish a connection or accept one. The SOCKS proxy server can either be a SOCKS v4 or v5 server and it has to allow for unauthenticated connections.
    I am using java.nio.channels.SocketChannel to do packets trasferring, and I've caught all the packets with Ethereal, but I find there's no packets to the socks proxy.
    What I use in the application is as below:
    System.getProperties().setProperty("socksProxySet", "true");
    System.getProperties().setProperty("socksProxyHost", socksProxyHost);
    System.getProperties().setProperty("socksProxyPort", socksProxyPort);I do this above before the connection issues. The connection lines are belows:
    SocketChannel s = SocketChannel.open();
    InetSocketAddress addr = new InetSocketAddress("daisho.waaaghtv.com",  10383);
    if (s.connect(addr)) {
      System.out.println("Socks Proxy Complete!");
    }else {
      System.out.println("Socks Proxy Failed!");
    }But every time it prints me "failed" message. I am sure that I can use the socks proxy to connect to daisho.waaaghtv.com:10383.
    My shortened program is:
    import java.net.InetSocketAddress;
    import java.nio.channels.SocketChannel;
    public class socketTest {
      public static void main(String[] args) {
        try{
          System.getProperties().setProperty("socksProxySet", "true");
          System.getProperties().setProperty("socksProxyHost", "166.111.70.13");
          System.getProperties().setProperty("socksProxyPort", "1080");
          SocketChannel s = SocketChannel.open();
          InetSocketAddress addr = new InetSocketAddress("daisho.waaaghtv.com",  10383);
          if (s.connect(addr)) {
            System.out.println("Socks Proxy Complete!");
          }else {
            System.out.println("Socks Proxy Failed!");
        }catch(Exception e) {
          e.printStackTrace();
    }The printed message is:
    java.net.ConnectException: Connection timed out: connect
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
         at socketTest.main(socketTest.java:12)I can find very limited help from internet, hope you could help me.

    But it's stated surely both in the 1.4 API and 1.5 API that it supports socks proxy by simply setting the system properties.
    I set socksProxySet to be true because I've found it from internet, but, yup, it seems useless.
    You mean the only way is to implement the socks proxy in my code? I know there is (or was, whatever) some open source project that is on this kinda topic, but ain't there a simple way?

  • SOCKS Server Authentication- Failed

    I am trying to access server through putty,sockes is configured, i am able to access one server, but when i am trying to access other server, its ask for SOCKS Server Authentication , username box is filled with my windows username, when i give pw it give username/pw errer...any idea to fix this?

    Please, please try to be much more precise about what you've done and what is configured. the question you are asking now this way can only be solved by the forum by either luck or clairvoyance.
    please answer the following questions:
    you've got a client with putty as an ssh client. is there any configuration done on putty? if yes, what?
    there's one host you can access apparently. is that host on the same network, or is the socks proxy needed to access that host? is there any configuration been done in putty for this specific host? (click on the host specification in putty, then click 'load'; that way the settings for that host are loaded. next look in the properties if there's some configuration been done)
    there's one host you can't access apparently. is that host on the same network,or is the socks proxy needed to access that host? is the configuration of this host different from the latter one?

  • Mac Adobe Flash Player not supporting Web Proxy Authentication

    Anyone else got an enterprise network where you use web proxies with web authentication and no traffic allowed out except through the proxies?
    You may need to be in the UK for this, but try accessing BBC iPlayer content - http://www.bbc.co.uk/iplayer and you should discover that the content won't play. the error says "This content doesn't seem to be working. Try again later.". The content will never work as the Mac version of Flash (currently 10.1.53.64) is not able to respond to web proxy authentication requests. The BBC use various streaming server which are randomly selected when a user starts a stream and they have no DNS. Just IP addresses. They don't publish a list for security reasons. So it is almost impossible to exempt all their servers from authentication.
    I've logged a bug with Adobe. If you have this issue too, please add a comment and vote so that they can begin to grasp the impact of this problem:
    https://bugs.adobe.com/jira/browse/FP-5161

    I have the same issues in Australia trying to access flash content from the ABC website. The strange thing is the content will play if your leave the browser open for 5min.
    After several packet data captures we identified that it has to do with the amount of time it takes the Mac timeout from the proxy before it plays the video content.
    No solution yet.

  • My app store is not working after installing mavericks. When I open app store it repeatedly asking me to login with apple ID and to provide User name and Password for proxy authentication in a loop.I am a newbie to mac,Please help me.

    My app store is not working after installing mavericks. When I open app store it repeatedly asking me to login with apple ID and to provide User name and Password for proxy authentication in a loop.I am a newbie to mac,Please help me.

    Hmmmm... would appear that you need to be actually logged in to enable the additional menu features.
    Have you tried deletting the plists for MAS?
    This page might help you out...
    http://www.macobserver.com/tmo/answers/how_to_identify_and_fix_problems_with_the _mac_app_store
    Failing that, I will have to throw this back to the forum to see if anyone else can advise further.
    Let me know how you get on?
    Thanks.

  • How to set proxy authentication using java properties at run time

    Hi All,
    How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
    => Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
    import java.io.*;
    import java.net.*;
    public class DnldURLWithoutUsingProxy {
       public static void main (String[] args) {
          URL u;
          InputStream is = null;
          DataInputStream dis;
          String s;
          try {
              u = new URL("http://www.yahoo.com.au/index.html");
             is = u.openStream();         // throws an IOException
             dis = new DataInputStream(new BufferedInputStream(is));
             BufferedReader br = new BufferedReader(new InputStreamReader(dis));
          String strLine;
          //Read File Line By Line
          while ((strLine = br.readLine()) != null)      {
          // Print the content on the console
              System.out.println (strLine);
          //Close the input stream
          dis.close();
          } catch (MalformedURLException mue) {
             System.out.println("Ouch - a MalformedURLException happened.");
             mue.printStackTrace();
             System.exit(1);
          } catch (IOException ioe) {
             System.out.println("Oops- an IOException happened.");
             ioe.printStackTrace();
             System.exit(1);
          } finally {
             try {
                is.close();
             } catch (IOException ioe) {
    }However, it generated the following message when run behind the firewall:
    cd C:\Documents and Settings\abc\DnldURL\build\classes
    java -cp . DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    at java.net.Socket.connect(Socket.java:452)
    at java.net.Socket.connect(Socket.java:402)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun.net.www.http.HttpClient.New(HttpClient.java:320)
    at sun.net.www.http.HttpClient.New(HttpClient.java:315)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    I have also tried the command without much luck either:
    java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
    There is no problem pinging www.yahoo.com from this system.
    I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
    I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
    Java Control Panel - Use browser settings without success.
    Thanks,
    George

    Hi All,
    How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
    => Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
    import java.io.*;
    import java.net.*;
    public class DnldURLWithoutUsingProxy {
       public static void main (String[] args) {
          URL u;
          InputStream is = null;
          DataInputStream dis;
          String s;
          try {
              u = new URL("http://www.yahoo.com.au/index.html");
             is = u.openStream();         // throws an IOException
             dis = new DataInputStream(new BufferedInputStream(is));
             BufferedReader br = new BufferedReader(new InputStreamReader(dis));
          String strLine;
          //Read File Line By Line
          while ((strLine = br.readLine()) != null)      {
          // Print the content on the console
              System.out.println (strLine);
          //Close the input stream
          dis.close();
          } catch (MalformedURLException mue) {
             System.out.println("Ouch - a MalformedURLException happened.");
             mue.printStackTrace();
             System.exit(1);
          } catch (IOException ioe) {
             System.out.println("Oops- an IOException happened.");
             ioe.printStackTrace();
             System.exit(1);
          } finally {
             try {
                is.close();
             } catch (IOException ioe) {
    }However, it generated the following message when run behind the firewall:
    cd C:\Documents and Settings\abc\DnldURL\build\classes
    java -cp . DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    at java.net.Socket.connect(Socket.java:452)
    at java.net.Socket.connect(Socket.java:402)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun.net.www.http.HttpClient.New(HttpClient.java:320)
    at sun.net.www.http.HttpClient.New(HttpClient.java:315)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    I have also tried the command without much luck either:
    java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
    There is no problem pinging www.yahoo.com from this system.
    I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
    I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
    Java Control Panel - Use browser settings without success.
    Thanks,
    George

  • Powershell Error for SharePoint Online -"The remote server returned an error: (407) Proxy Authentication Required."

    I am trying to call sharepoint online from powershell. Below is the code. I get 
    Exception calling "ExecuteQuery" with "0" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
    $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
    $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
    $webUrl = "ZZZZ"
    $username = "XXX"
    $password = "YYYY"
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl) 
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
    $web = $ctx.Web
    $lists = $web.Lists 
    $ctx.Load($lists)
    $ctx.ExecuteQuery()
    $lists| select -Property Title
    Raj-Shpt

    Hi,
    About how to access SharePoint online site using PowerShell, the blog below would be helpful:
    http://social.technet.microsoft.com/wiki/contents/articles/29518.csom-sharepoint-powershell-reference-and-example-codes.aspx
    Another two demos for your reference:
    http://www.hartsteve.com/2013/06/sharepoint-online-powershell/
    http://www.sharepointnutsandbolts.com/2013/12/Using-CSOM-in-PowerShell-scripts-with-Office365.html
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • ITunes 10.6 Proxy Authentication Problem

    As all we know, since we've installed iTunes 10.6, we're having issues with proxy authentication. Whenever i want to connect to iTunes Store or open iTunes it always asks me about my username and password even thoug i check Remember Me check box.
    I wonder if you did gave any feedback or answer from Apple?
    Thanks

    same issue, even w/ the 10.6.3 update.
    very disappointing.
    looks like this thread is a duplicate of https://discussions.apple.com/thread/3803634?start=0&tstart=0

  • Administration of APEX in SQL Developer with Proxy Authentication impossibl

    Hello!
    We are using latest version of SQL Developer to administer APEX. We are connecting to the database with proxy authentication. The syntax is:
    personal_user[apex_ws_owner]
    e.g.: mdecker[apex_demo]
    When trying to deploy APEX application I go to "Database Object" -> Application Express -> Application1 [100] -> right mouse click: "Deploy Application". Then I select the appropriate database identifier and next, I am presented with a screen showing import options. In second line, it says: "Parsing Schema: MDECKER".
    This is wrong: it has to be Parsing Schema: APEX_DEMO. It seems that managing APEX with SQL Developer does not support Proxy Authentication.
    Could you please confirm?
    Is there a way to formally ask for this enhancement?
    Best regards,
    Martin
    Update:
    I found out that if I check the flag "Proxy Authentication" in the connect details and provide both passwords, the deploy application parsing schema is set to the correct APEX_DEMO account. However, we are using Proxy Authentication in order to avoid having to know the application password.
    Edited by: mdecker on Jan 28, 2013 4:48 PM

    There is a write-up about connecting to APEX here: <a href ="http://www.oracle.com/technology/products/database/application_express/html/sql_dev_integration.html" >SQL Dev Oracle APEX Integration</a>
    <p>You do need to have updated to Oracle APEX 3.0.1.
    <p>Regards <br>
    Sue

  • How to pass Proxy user dynamically in Toplink proxy authentication?

    Hi,
    I'm using Toplink Proxy Authentication with my ADF JSF application and want to pass the Proxy user dynamically to the preLogin(..) method of mySessionEventListener (Currently proxy user is hard coded).
    This is to make my application user as the Proxy user.
    I have tried to do this in two ways:
    1) In my Login screen Backing Bean, I retrieve the session as
    session = sessionFactory.acquireSession(); and set the application user in it as
    session.setProperty("proxyUser1", inputText1.getValue());
    But,
    session.getProperty("proxyUser1") returns null in the preLogin(..) method
    2) I add a loginUser property to the mySessionEventListener class and create a constructor to set it.
    Then I call the constructor from my Login Backing Bean as
    mySessionEventListener eventMgr = new mySessionEventListener(<proxy_user>);
    session.getEventManager().addListener( eventMgr );
    But, the loginUser property seeems to be transient and does not retain value when retrieved in preLogin(..) method.
    Please indicate if anything is wrong. Also, is there any other way to get this done?
    Thanks in advance.
    Vikas

    Hi Vikas,
    Probably your sessions.xml defines a ServerSession, and acquireSession method returns a ClientSession. ServerSession is the object that connects to the database, it may have any number of ClientSessions associated with it - all of them use connections provided by ServerSession's connection pools.
    So if you'd like to alter the serverSession before login, acquireSession is too late - it triggers login of the ServerSession and returns a ClientSession.
    To get the ServerSession before login:
    // the first param indicates that the session shouldn't be connected
    Session serverSession = sessionFactory.getSharedSession(false, false);Now you have a serverSession on which login hasn't been called yet.
    You can set the property into the session, or directly into its login.
    In fact you may choose to do whatever you wanted to do in preLogin right here - in this case no preLogin event would be required of course.
    Finally to get a ClientSession, call the same api did:
    // the first param indicates that the session shouldn't be connected
    Session clientSession = sessionFactory.getSession();On the first such call the ServerSession will be connected.
    Note that because all the ClientSessions will connect through the connections provided by the same ServerSession they will all use proxyUser1.
    If you are interested in using different proxy users for different ClientSessions http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/dblgcfg008.htm#BABDABCF lists several scenarios for that.
    Andrei

  • Oracle Proxy Authentication and WLS 8.1/CMP

    Hey folks,
    Is there any way to configure WLS 8.1 to automatically set the Oracle CLIENT_IDENTIFIER
    variable or use Oracle Proxy Authentication on JDBC connections? I'm interested
    in using Oracle auditing with my CMP entity beans, but would like to capture the
    app tier user identity, instead of the data source pool user.
    Thanks.

    "Brent Smith" <[email protected]> wrote in message
    news:3fa15807$[email protected]..
    >
    Hey folks,
    Is there any way to configure WLS 8.1 to automatically set the OracleCLIENT_IDENTIFIER
    variable or use Oracle Proxy Authentication on JDBC connections? I'minterested
    in using Oracle auditing with my CMP entity beans, but would like tocapture the
    app tier user identity, instead of the data source pool user.
    I would ask in the weblogic.developer.interest.jdbc newsgroup.

  • Acrobat Standard Proxy Authentication

    Hi,
    When we sign our PDF's we want to use an external timestamping server
    So we have configured both a Verisign and Globalsign timestamping server and made one of them as default
    Most of the time we got a response from Acrobat saying
    "Timestamp signature property generation error:
    Transport authorization failure"
    When it fails the doc is signed, but using the computers clock and we want to avoid that
    But sometime it did work which confused us but I think we have identified the problem with the Proxy authentication
    Our proxy requires full authetication against our Active Directory
    So when it worked was just because we just before signing had been surfing on the internet and the proxy had cached the credential approvals
    So when Adobe tried to get out to the timestamp server the ID was already authorized in the proxy
    But without a previous "IE-surfing" it fails, the proxy has nothing in its cache
    A network trace confirms this,  we see a "Authentication required" request from the proxy that Acrobat never responds to
    The proxy does not accept annonymous requests
    IE is configured to use a configration script for its proxy settings
    I cant find any relevant Acrobat settings that handles this and googling indicates that Acrobat has problems in this area
    But I haven't found anything for our version/release
    Now for the question, is Adobe Acrobat Standard 9.3.0 supposed to handle proxys that requires AD authentication?
    To bypass the proxy is not an option
    Setting a proxy exception for these servers is maybe an option
    Prefered is that Acrobat handles this

    To update my own question since it might help others
    I received assistance through the Adobe support channels
    Not what I was hoping for but it clarifies the problem
    The reason I asked the question is that we don’t support Shared Review with an Authenticating Proxy server. So this customer workflow isn’t too far off the mark with having a proxy server authentication expectation in the standalone client and wanting a timestamp server time.   The only workaround to this behavior is to do exactly what they have found.  Launch an instance of Internet Explorer, authenticate against the proxy server and then sign the PDF file.

  • Http proxy authentication for JDev 10.1.3

    Hi,
    I found the http proxy settings in the "tools->preferences->Web Browser and Proxy" but there are no settings for the username and password. Is there some other way that I can add these.
    The problem is that whenver JDeveloper wants to do some http stuff it (or something else is doing it) asks me for the proxy user name & password - this happens over and over again. If JDev is doing this then surely it should remember the username & password.
    I sometimes get a JDeveloper dialog "waiting for the connection" come up over the proxy auth dialog and I have to cancel the function so I can authenticate, then re-request the function.
    I wish I didn't have the proxy authentication but I have no choice in this dev environment. I do get to choose JDeveloper at least.
    Regards,
    Simon.

    Hi,
    I get it when I 'check for updates' and I get it again when I 'go to JavaDoc' - and this is the one where the "waiting for connection dialog" pops on top of the proxy log in and I have to cancel it to log in. Then all subsequent 'go to JavaDoc' requests go straight through.
    I would prefer it if I could just configure (in proxy preferences) the username and password so it never asks me. I dont care if it less secure storing the password since I think authenticating proxies are a dumb idea anyway. If the password is not supplied then JDev can ask for it like it does now to keep the security-paranoid people happy.
    Also, this morning I got this Exception which appeared at the same time I got a proxy auth window. When JDev finally started all my previously open windows were lost. No real problem but unexpected. Here is the stack dump:
    java.lang.NullPointerException
         at oracle.jdevimpl.webdav.api.DAVAuthenticator.getPasswordAuthentication(DAVAuthenticator.java:79)
         at java.net.Authenticator.requestPasswordAuthentication(Authenticator.java:300)
         at sun.net.www.protocol.http.HttpURLConnection$1.run(HttpURLConnection.java:267)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.net.www.protocol.http.HttpURLConnection.privilegedRequestPasswordAuthentication(HttpURLConnection.java:263)
         at sun.net.www.protocol.http.HttpURLConnection.getHttpProxyAuthentication(HttpURLConnection.java:1427)
         at sun.net.www.protocol.http.HttpURLConnection.resetProxyAuthentication(HttpURLConnection.java:1246)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:950)
         at oracle.ide.net.HttpURLFileSystemHelper.exists(HttpURLFileSystemHelper.java:191)
         at oracle.jdevimpl.webdav.net.WebDAVURLFileSystemHelper.exists(WebDAVURLFileSystemHelper.java:423)
         at oracle.ide.net.URLFileSystem.exists(URLFileSystem.java:498)
         at oracle.ideimpl.editor.EditorUtil.getNode(EditorUtil.java:126)
         at oracle.ideimpl.editor.EditorUtil.loadContext(EditorUtil.java:91)
         at oracle.ideimpl.editor.TabGroupState.loadStateInfo(TabGroupState.java:950)
         at oracle.ideimpl.editor.TabGroup.loadLayout(TabGroup.java:1758)
         at oracle.ideimpl.editor.TabGroupXMLLayoutPersistence.loadComponent(TabGroupXMLLayoutPersistence.java:31)
         at oracle.ideimpl.controls.dockLayout.DockLayoutInfoLeaf.loadLayout(DockLayoutInfoLeaf.java:123)
         at oracle.ideimpl.controls.dockLayout.AbstractDockLayoutInfoNode.loadLayout(AbstractDockLayoutInfoNode.java:631)
         at oracle.ideimpl.controls.dockLayout.AbstractDockLayoutInfoNode.loadLayout(AbstractDockLayoutInfoNode.java:628)
         at oracle.ideimpl.controls.dockLayout.AbstractDockLayoutInfoNode.loadLayout(AbstractDockLayoutInfoNode.java:614)
         at oracle.ideimpl.controls.dockLayout.DockLayout.loadLayout(DockLayout.java:302)
         at oracle.ideimpl.controls.dockLayout.DockLayoutPanel.loadLayout(DockLayoutPanel.java:128)
         at oracle.ideimpl.editor.Desktop.loadLayout(Desktop.java:353)
         at oracle.ideimpl.editor.EditorManagerImpl.init(EditorManagerImpl.java:1824)
         at oracle.ide.layout.Layouts.activate(Layouts.java:758)
         at oracle.ide.layout.Layouts.activateLayout(Layouts.java:179)
         at oracle.ideimpl.MainWindowImpl$2.runImpl(MainWindowImpl.java:734)
         at oracle.javatools.util.SwingClosure$1Closure.run(SwingClosure.java:50)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Maybe you are looking for

  • Download data from memory to Excel format.

    Hi Gurus,     How can I download data from Memory( not in application server ) to Excel format ? Now I am using below function modules  but not coming in proper format. CALL FUNCTION 'LIST_FROM_MEMORY'        TABLES             listobject = listobjec

  • AppleScript to batch change 'Initial View' of PDF Documents Acrobat 9 Pro

    Hi I'm struggling to write a script that takes a bunch of PDF documents and opens those in Acrobat 9 Pro. Changes the Inital View settings (ie. Page layout = Single Page and Magnification = Fit Page) and saves the changes. Is this possible with Acrob

  • UMA Lumia on T-Mobile

    I (and every t-mobile user) am hoping you (nokia) will come out with a UMA supported 900 series Windows Lumia phone that uses AWS-1 or UMTS band IV. Who do I have to... contact in order to make this happen.

  • Reset an expired password in 11g

    I'm having a weird problem in 11.2.0.2. I'm trying to reset an user password which was expired. It throws me an error "ORA-00911: invalid character". The password follows all the policies and the same type of password is working for other users. Can

  • Did you hear that? A new version of Edge Animate CC will break Edge Animate?

    I'm on a OSX10.9.1. Updated Edge, hoping for some of the many bugs to disappear. Ended up with unusable software. When I open Edge Animate now, I only get a white screen. If I try to open a previous file or make a new one, I cant do anything without