@Override
    public Map<String, List<Object>> getAttributes(final RegisteredServiceAttributeReleasePolicyContext context) {
        try {
            val merger = CoreAuthenticationUtils.getAttributeMerger(mergingPolicy);
            val attributes = new HashMap<String, List<Object>>();
            policies
                .stream()
                .filter(Objects::nonNull)
                .filter(policy -> policy.getActivationCriteria() == null || policy.getActivationCriteria().shouldActivate(context))
                .sorted(AnnotationAwareOrderComparator.INSTANCE)
                .filter(context.getAttributeReleasePolicyPredicate())
                .forEach(Unchecked.consumer(policy -> {
                    LOGGER.trace("Fetching attributes from policy [{}] for principal [{}]",
                        policy.getName(), context.getPrincipal().getId());
                    val policyAttributes = policy.getAttributes(context);
                    val results = new HashMap<>(merger.mergeAttributes(attributes, policyAttributes));
                    LOGGER.trace("Attributes that remain, after the merge with attribute policy results, are [{}]", results);
                    attributes.clear();
                    attributes.putAll(results);
                    context.getReleasingAttributes().clear();
                    context.getReleasingAttributes().putAll(attributes);
                }));
            return attributes;
        } finally {
            context.getReleasingAttributes().clear();
        }
    }
This is {@link ChainingAttributeReleasePolicy}.

@author Misagh Moayyed
@since 5.1.0
core/cas-server-core-authentication-attributes/src/main/java/org/apereo/cas/services/ChainingAttributeReleasePolicy.java