@Override
    public void customizeAssertion(final SamlProfileBuilderContext context, final Saml20ObjectBuilder builder, final Assertion assertion) {
        val attributes = context.getAuthenticatedAssertion().orElseThrow().getAttributes();
        LOGGER.debug("Attributes to evaluate to customize SAML2 assertion are [{}]", attributes);
        if (attributes.containsKey(Pac4jConstants.CLIENT_NAME) && !context.getRegisteredService().isSkipGeneratingAuthenticatingAuthority()) {
            val clientNames = CollectionUtils.toCollection(attributes.get(Pac4jConstants.CLIENT_NAME));
            val webContext = new JEEContext(Objects.requireNonNull(context.getHttpRequest()),
                Objects.requireNonNull(context.getHttpResponse()));
            clientNames.forEach(clientName -> identityProviders.findClient(clientName.toString(), webContext)
                .filter(SAML2Client.class::isInstance)
                .map(SAML2Client.class::cast)
                .ifPresent(client -> {
                    client.init();
                    assertion.getAuthnStatements().forEach(authnStatement -> {
                        val authnContext = authnStatement.getAuthnContext();
                        val authority = builder.newSamlObject(AuthenticatingAuthority.class);
                        authority.setURI(client.getIdentityProviderResolvedEntityId());
                        LOGGER.debug("Customizing SAML2 assertion to include authenticating authority [{}] linked to delegated client [{}]",
                            client.getIdentityProviderResolvedEntityId(), clientName);
                        authnContext.getAuthenticatingAuthorities().add(authority);
                    });
                }));
        }
    }
This is {@link DelegatedAuthenticationSamlIdPResponseCustomizer}.

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