code: static public String[] getBasicAuthUsernameAndPassword(HttpServletRequest request){
  		String authorization = request.getHeader("Authorization");
  	    if (authorization != null && authorization.startsWith("Basic")) {
  	    	try{
  		        // Authorization: Basic base64credentials
  		        String base64Credentials = authorization.substring("Basic".length()).trim();
  		        String credentials = new String(Base64.decode(base64Credentials), "UTF-8");
  		        // credentials = username:password
  		        String[] values = StringUtils.split(credentials, ':');
  		        return values;
  	    	}catch(Exception e){
  	    		// ignore
  	    	}
  	    }
  	    return null;
  	}
docs: Get the user name and password passed in the basic authentication header.
  @param request	the http servlet request
  @return	user name and password, or null if not found. If there is no password,
  the result may contain only one element, or two elements and the second element is null or empty.