protected SAML2Client buildSaml2ClientFromAggregate(final SAML2Client saml2Client,
                                                        final EntityDescriptor entityDescriptor,
                                                        final Pac4jSamlClientProperties saml2Properties,
                                                        final CasConfigurationProperties properties) {
        val configuration = saml2Client.getConfiguration();
        LOGGER.trace("Loading SAML2 client for identity provider with entity id [{}]", entityDescriptor.getEntityID());

        val singleConfiguration = createSaml2Configuration(entityDescriptor, configuration);
        val singleClient = createSaml2Client(saml2Client, singleConfiguration);

        val clientName = saml2Client.getName() + '-' + RandomUtils.nextLong();
        DelegatedIdentityProviderFactory.configureClientName(singleClient, clientName);
        DelegatedIdentityProviderFactory.configureClientCustomProperties(singleClient, saml2Properties);
        DelegatedIdentityProviderFactory.configureClientCallbackUrl(singleClient, saml2Properties, properties.getServer().getLoginUrl());
        singleClient.getCustomProperties().put(ClientCustomPropertyConstants.CLIENT_CUSTOM_PROPERTY_IDENTITY_PROVIDER_METADATA_AGGREGATE, true);

        val idpSSODescriptor = entityDescriptor.getIDPSSODescriptor(SAMLConstants.SAML20P_NS);
        Optional.ofNullable(idpSSODescriptor)
            .map(IDPSSODescriptor::getExtensions)
            .map(ext -> ext.getUnknownXMLObjects(UIInfo.DEFAULT_ELEMENT_NAME))
            .stream()
            .flatMap(List::stream)
            .map(UIInfo.class::cast)
            .filter(uiInfo -> !uiInfo.getDisplayNames().isEmpty())
            .map(uiInfo -> uiInfo.getDisplayNames().getFirst().getValue())
            .filter(StringUtils::isNotBlank)
            .findFirst()
            .ifPresent(value -> singleClient.getCustomProperties().put(ClientCustomPropertyConstants.CLIENT_CUSTOM_PROPERTY_DISPLAY_NAME, value));
        singleClient.init();
        return singleClient;
    }
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