Develop and Download Open Source Software

Ticket #12418

Open Date: 2008-04-27 11:46

Last Update: 2008-04-29 12:02

java.net.Authenticator doesn't work

Reporter:(Anonymous)Owner:freebeans
Priority:5 - MediumMileStone:(None)
Type:BugsSeverity:5 - Medium
Component:v0.3.7Status:Open [Owner assigned]
ResolutionAccepted

Details

The following lines of code add HTTP BASIC
Authentication Header Token to the http request
message, like
"Authorization: Basic base64encoded(username:password)".

The code works fine under desktop JVM, while in
mysaifu, 401 UNAUTHORIZED is returned.

Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication
getPasswordAuthentication() {
return new PasswordAuthentication
(username, password.toCharArray());
}
});

Attach File

File ListNo attachments.
Add New attachment
Add attachment filesPlease login to add new attachment

Ticket History - 3/3 Histories

2008-04-28 09:44 Update by: freebeans

  • Resolution Update from None to Accepted.
  • Owner Update from (None) to freebeans.

2008-04-29 10:41 Update by: freebeans

Comment

Logged In: YES
user_id=14530

I checked source code of gnu.java.net package, I'm not sure
bug it seems that GNU Classpath does not support
java.net.Authenticator.

2008-04-29 12:02 Update by: None

Comment

Logged In: NO

No biggie. I have a workaround of adding an HTTP BASIC
Authentication header via java.net.HttpURLConnection class
as follows,

httpURLConnection.setRequestProperty("Authorization",
"Basic
"+Base64.encodeBytes((username+":"+password).getBytes()));

along with the Base64 class from here,

http://iharder.sourceforge.net/current/java/base64/

Thanks


Add Comment/Update #12418 (java.net.Authenticator doesn't work)

Please login to add comment to this ticket. » Login


SourceForge.JP is a Japanese version of SourceForge.net. For developments that are not related to Japan, we recommend you to use SourceForge.net.