@Override
    public List<? extends BaseClient> configure(final BaseClient client,
                                                final Pac4jBaseClientProperties clientProperties,
                                                final CasConfigurationProperties properties) throws Exception {
        if (client instanceof final SAML2Client saml2Client
            && clientProperties instanceof Pac4jSamlClientProperties saml2Properties
            && saml2Properties.getMetadata().isIdentityProviderMetadataAggregate()) {
            LOGGER.info("Loading SAML2 identity provider metadata from [{}]",
                saml2Properties.getMetadata().getIdentityProviderMetadataPath());
            saml2Client.init();
            LOGGER.info("Loaded SAML2 identity provider metadata from [{}]",
                saml2Properties.getMetadata().getIdentityProviderMetadataPath());
            val idpMetadataResolver = saml2Client.getIdentityProviderMetadataResolver();

            val metadataResolver = idpMetadataResolver.resolve();
            val providers = metadataResolver.resolve(new CriteriaSet(new EntityRoleCriterion(IDPSSODescriptor.DEFAULT_ELEMENT_NAME)));
            if (Iterables.size(providers) > 1) {
                val stopWatch = new StopWatch();
                stopWatch.start();
                val results = new ArrayList<SAML2Client>();
                try (val executor = Executors.newVirtualThreadPerTaskExecutor()) {
                    val futures = Arrays.stream(Iterables.toArray(providers, EntityDescriptor.class))
                        .parallel()
                        .map(entityDescriptor -> executor.submit(
                            () -> buildSaml2ClientFromAggregate(saml2Client, entityDescriptor, saml2Properties, properties)))
                        .toList();

                    for (val future : futures) {
                        results.add(future.get());
                    }
                    executor.shutdown();
                }
                stopWatch.stop();
                LOGGER.info("Loaded [{}] SAML2 identity provider metadata in [{}]",
                    results.size(), stopWatch.getDuration());
                return results;
            }
        }
        return ConfigurableDelegatedClientBuilder.super.configure(client, clientProperties, properties);
    }
This is {@link DelegatedClientSaml2Builder}.

@author Misagh Moayyed
@since 7.1.0
support/cas-server-support-pac4j-saml/src/main/java/org/apereo/cas/web/saml2/DelegatedClientSaml2Builder.java