47 if (header.length() < 6)
return null;
48 String type = header.substring(0, 5);
49 type = type.toLowerCase();
50 if (!type.equalsIgnoreCase(
"Basic"))
return null;
51 String val = header.substring(6);
53 val =
new String(Base64.decode(val.getBytes()));
54 }
catch (IOException e) {
55 throw new RuntimeException(e);
57 int seperatorIndex = val.indexOf(
":");
58 if(seperatorIndex == -1)
return null;
59 String user = val.substring(0, seperatorIndex);
60 String pw = val.substring(seperatorIndex + 1);
61 return new String[]{user,pw};