class CompositeReactiveAuthenticationManager implements ReactiveAuthenticationManager {

    private final List<ReactiveAuthenticationManagerProvider> providers;

    @Override
    public Mono<Authentication> authenticate(Mono<AuthenticationRequest> request) {<FILL_FUNCTION_BODY>}

    @Override
    public Mono<Authentication> getByUserId(String userId) {
        return Flux
                .fromStream(providers
                                    .stream()
                                    .map(manager -> manager
                                            .getByUserId(userId)
                                            .onErrorResume((err) -> {
                                                log.warn("get user [{}] authentication error", userId, err);
                                                return Mono.empty();
                                            })
                                    ))
                .flatMap(Function.identity())
                .collectList()
                .filter(CollectionUtils::isNotEmpty)
                .map(all -> {
                    if (all.size() == 1) {
                        return all.get(0);
                    }
                    SimpleAuthentication authentication = new SimpleAuthentication();
                    for (Authentication auth : all) {
                        authentication.merge(auth);
                    }
                    return authentication;
                });
    }
}

        return Flux.concat(providers
                                   .stream()
                                   .map(manager -> manager
                                           .authenticate(request)
                                           .onErrorResume((err) -> {
                                               log.warn("get user authenticate error", err);
                                               return Mono.empty();
                                           }))
                                   .collect(Collectors.toList()))
                   .take(1)
                   .next();
    
<no_super_class>