public boolean authenticate(String login, String password) {
        User user = db.getUserByLogin(login);
        if (user!=null){
            if(user.getPasswordHash().equals(password)){
                authenticatedRole = user.getRole();
                authenticatedUser = user;
                return true;
            }
            else return false;
        }
        else return false;
       
    }