Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Basic Authentication

843811Apr 14 2004 — edited Apr 2 2007
I am trying to pass the username and password to a URL protected using basic authentication programatically.

I have a JSP that has a valid username and password. I construct the Authorization header and redirect to the protected URL as follows :

BASE64Encoder encoder = new BASE64Encoder();
String str = "admin:welcome"; // username and password
String encodedStr = encoder.encodeBuffer(str.getBytes());

response.setHeader("Authorization","Basic "+encodedStr);
String url = "http://incq044b.idc..com:80"; // protected url

response.sendRedirect(url);

But it does not redirect me to the protected page. Instead, it gives a Page not found error.
Has anybody got this to work.
Thanks for help

Chan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2007
Added on Apr 14 2004
22 comments
691 views