public long userAuthentication(String username, String password) {
        if (username == null || password == null || username.isEmpty() || password.isEmpty()) {
            return -1;
        }

        User user = userDAO.getUserByUsername(username);
        if (user != null && BCrypt.checkpw(password, user.getPassword())) {
            user.setUserId(userIdGenerator.getAndIncrement());
            users.put(user.getUserId(), user);
            return user.getUserId();
        }
        else {
            return -1;
        }
    }