public boolean authenticate(String username, String password) throws LoginException
    {
        if (debug)
        {
            LOG.debug("Trying to authenticate user: " + username);
        }

        boolean authenticated = false;

        UserData result = authenticationDao.loadUserData(username);
        if (result.getSalt() != null && result.getPassword() != null)
        {
            if (debug)
            {
                LOG.debug("Salt and password loaded from database");
            }

            authenticated = checkPasswordMatching(password, result);
        }

        return authenticated;
    }