troubleshooting Question

Java Applet Proxy Authentication Issue.

Avatar of sachmans
sachmans asked on
Java
1 Comment1 Solution2715 ViewsLast Modified:
Hi there.

I have an Java Applet that runs in a browser.
It essentially acts as a SOCKS proxy server and tunnels a single connection through a HTTP proxy server (if one is present) to an external TCP service.

This Applet works fine, except when the proxy server requires authentication.

I have proxy detection code in my applet. If the proxy server requires authentication then the applet will pop-up a username/password dialog for the proxy server credentials. This is ok. I think the code that triggers the dialog is:

ProxyInfo info[] = ProxyService.getProxyInfo(new URL(host));
                  
The problem is that once the proxy server is determined I connect through it using Non-Blocking Sockets, which doesn't use the proxy credentials that were typed in earlier. I can pass the proxy credentials through in the header of the HTTP request that is used for initialising the tunnel, but these must be typed in again by the user.

I just don't want to have to ask the user for creditials twice.

I have tried using a custom java.net.Authenticator object, but I have been unable to override the default popup, or hard-code the username and password in my own Authenticator.

So essentially I need to know:

Is there a way to suppress the authentication dialog that popups when I detect the proxy server? This way I can prompt the user for the username and password in the HTML page and then pass it to the applets outgoing TCP connection.

OR

Is there away to get the username and password that was typed into the popup dialog so that I can pass the Username and password through to the proxy when i create the outgoing TCP connection?

Thanks.

Peter
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros