This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Authenticator Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Authenticator Class" Watch "Authenticator Class" New topic
Author

Authenticator Class

Abhijt Rao
Greenhorn

Joined: Oct 30, 2008
Posts: 2
hi i have this piece of code for conecting to authenticated proxy in my class
static class MyAuthenticator extends Authenticator {

MyAuthenticator() {
}

protected PasswordAuthentication getPasswordAuthentication() {
System.out.println("PasswordAuthentication ");
return new PasswordAuthentication(
System.getProperty("sonic.http.proxyUsername"), System.getProperty("sonic.http.proxyPassword").toCharArray());
}

}

and I also do

MyAuthenticator myAuth = new MyAuthenticator();

Authenticator.setDefault(myAuth);

This code works absolutely fine in j2sdk1.4 and the getpasswordAuthentication method is called but in jdk1.5 (i am using jdk1.5.0_13) this method doesnt get called at all

Do i need to do something differently for 1.5?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8935
    
    9

Welcome to the JavaRanch.
You must have missed our naming policy on the way in. In short, your displayed name must be your real (or at least real-sounding) first and last name separated by a space. You can change your displayed name here.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Abhijt Rao
Greenhorn

Joined: Oct 30, 2008
Posts: 2
Hi

These are my connection parameters

https.proxyHost=
https.proxyPort=
sonic.https.useAnyHostnameVerifier=true
sonic.https.proxyAuthentication=true
sonic.http.proxyUsername=
sonic.http.proxyPassword=
javax.net.ssl.trustStore=<set to my certs directory>
 
 
subject: Authenticator Class