Account acct = prov.getAccountByName(user);
Account acct = prov.get(AccountBy.NAME, user);
    protected Account basicAuthRequest(HttpServletRequest req, HttpServletResponse resp, boolean sendChallenge) throws IOException, ServletException, ServiceException {        String auth = req.getHeader("Authorization");        // TODO: more liberal parsing of Authorization value...        if (auth == null || !auth.startsWith("Basic ")) {        	if (sendChallenge) {        		resp.addHeader(WWW_AUTHENTICATE_HEADER, getRealmHeader());                    		resp.sendError(HttpServletResponse.SC_UNAUTHORIZED, "must authenticate");        	}            return null;        }        // 6 comes from "Basic ".length();        String userPass = new String(Base64.decodeBase64(auth.substring(6).getBytes()));        int loc = userPass.indexOf(":");         if (loc == -1) {            resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "invalid basic auth credentials");            return null;        }                String user = userPass.substring(0, loc);        String pass = userPass.substring(loc + 1);        Provisioning prov = Provisioning.getInstance();        Account acct = prov.getAccountByName(user);        if (acct == null) {        	if (sendChallenge) {        		resp.addHeader(WWW_AUTHENTICATE_HEADER, getRealmHeader());        		resp.sendError(HttpServletResponse.SC_UNAUTHORIZED, "invalid username/password");        	}            return null;        }        try {            prov.authAccount(acct, pass);        } catch (ServiceException se) {        	if (sendChallenge) {        		resp.addHeader(WWW_AUTHENTICATE_HEADER, getRealmHeader());        		resp.sendError(HttpServletResponse.SC_UNAUTHORIZED, "invalid username/password");        	}            return null;        }        return acct;    }