class AuthenticationHolder {
    private static final List<AuthenticationSupplier> suppliers = new ArrayList<>();

    private static final ReadWriteLock lock = new ReentrantReadWriteLock();

    private static Optional<Authentication> get(Function<AuthenticationSupplier, Optional<Authentication>> function) {
        int size = suppliers.size();
        if (size == 0) {
            return Optional.empty();
        }
        if (size == 1) {
            return function.apply(suppliers.get(0));
        }
        SimpleAuthentication merge = new SimpleAuthentication();
        for (AuthenticationSupplier supplier : suppliers) {
            function.apply(supplier).ifPresent(merge::merge);
        }
        if (merge.getUser() == null) {
            return Optional.empty();
        }
        return Optional.of(merge);
    }

    /**
     * @return 当前登录的用户权限信息
     */
    public static Optional<Authentication> get() {

        return get(AuthenticationSupplier::get);
    }

    /**
     * 获取指定用户的权限信息
     *
     * @param userId 用户ID
     * @return 权限信息
     */
    public static Optional<Authentication> get(String userId) {
        return get(supplier -> supplier.get(userId));
    }

    /**
     * 初始化 {@link AuthenticationSupplier}
     *
     * @param supplier
     */
    public static void addSupplier(AuthenticationSupplier supplier) {<FILL_FUNCTION_BODY>}

}

        lock.writeLock().lock();
        try {
            suppliers.add(supplier);
        } finally {
            lock.writeLock().unlock();
        }
    
<no_super_class>