//Get credentials from authourization header.
if (authorization != null
&& authorization.toLowerCase().startsWith("basic ")) {
authorization = authorization.substring(6).trim();
BASE64Decoder decoder = new BASE64Decoder();
byte[] bs = decoder.decodeBuffer(authorization);
String decodedString = new String(bs);
int ind = decodedString.indexOf(':');
if (ind > 0) {
username = decodedString.substring(0, ind);
password = decodedString.substring(ind + 1);