@Override
    public Map<String, List<Object>> getAttributesInternal(final RegisteredServiceAttributeReleasePolicyContext context,
                                                           final Map<String, List<Object>> attributes) throws Throwable {
        if (context.getRegisteredService() instanceof SamlRegisteredService) {
            val applicationContext = context.getApplicationContext();
            val resolver = applicationContext.getBean(SamlRegisteredServiceCachingMetadataResolver.BEAN_NAME,
                SamlRegisteredServiceCachingMetadataResolver.class);
            val entityId = getEntityIdFromRequest(context);
            val facade = StringUtils.isBlank(entityId)
                ? Optional.<SamlRegisteredServiceMetadataAdaptor>empty()
                : determineServiceProviderMetadataFacade(context, entityId);

            if (facade.isEmpty()) {
                LOGGER.warn("Could not locate metadata for [{}] to process attributes", entityId);
                return new HashMap<>();
            }

            val entityDescriptor = facade.get().getEntityDescriptor();
            return getAttributesForSamlRegisteredService(attributes, resolver, facade.get(), entityDescriptor, context);
        }
        return authorizeReleaseOfAllowedAttributes(context, attributes);
    }
This is {@link BaseSamlRegisteredServiceAttributeReleasePolicy}.

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