I have a small issue. I am using HTTP Basic Authentication to enforce security in the website. I am able to get the "Authorization" header information in the Servlet request, but the data contained under that header is not in ASCII format. It is binary, I believe. Thus, when I try to perform the following code.
String userInfo=new String();
userInfo = authorization.substring(6).trim();
BASE64Decoder decoder = new BASE64Decoder();
namePassword = new String(decoder.decodeBuffer(userInfo));
catch (Exception e)
int index = namePassword.indexOf(":");
user_text = namePassword.substring(0, index);
password_text = namePassword.substring(index+1);
catch (Exception ce)
here, namePassword is returning data in binary format, so the ce exception is showing "String index out of bounds"??
Is there any way to convert namePassword to ASCII format, so that I can exteact the user name and password??
please let me know.