Base64.decode(authStr[1].toCharArray(), out);
String decAuthStr = out.toString("ISO-8859-1");
int pos = decAuthStr.indexOf(':');
String userid = decAuthStr.substring(0, pos);
String passwd = decAuthStr.substring(pos + 1);
return new SimpleCredentials(userid, passwd.toCharArray());
}
throw new ServletException("Unable to decode authorization.");
} else {
// check special handling
if (defaultHeaderValue == null) {
throw new LoginException();
} else if (defaultHeaderValue.equals("")) {
return null;
} else {
int pos = defaultHeaderValue.indexOf(':');
if (pos<0) {
return new SimpleCredentials(defaultHeaderValue, null);
} else {
return new SimpleCredentials(
defaultHeaderValue.substring(0, pos),
defaultHeaderValue.substring(pos+1).toCharArray()
);
}
}