private Map<String, List<Object>> fetchRequestedAttributes(final Map<String, List<Object>> attributes,
                                                               final RegisteredServiceAttributeReleasePolicyContext context,
                                                               final SamlRegisteredServiceMetadataAdaptor facade) {
        val releaseAttributes = new HashMap<String, List<Object>>();
        Optional.ofNullable(facade.getSsoDescriptor())
            .ifPresent(sso -> sso.getAttributeConsumingServices().forEach(svc -> svc.getRequestedAttributes().stream().filter(attr -> {
                val name = this.useFriendlyName ? attr.getFriendlyName() : attr.getName();
                LOGGER.debug("Checking for requested attribute [{}] in metadata for [{}]",
                    name, context.getRegisteredService().getName());
                return attributes.containsKey(name);
            }).forEach(attr -> {
                val name = this.useFriendlyName ? attr.getFriendlyName() : attr.getName();
                LOGGER.debug("Found requested attribute [{}] in metadata for [{}]",
                    name, context.getRegisteredService().getName());
                releaseAttributes.put(name, attributes.get(name));
            })));
        return releaseAttributes;
    }
This is {@link MetadataRequestedAttributesAttributeReleasePolicy}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/services/MetadataRequestedAttributesAttributeReleasePolicy.java