@Override
    protected Map<String, List<Object>> getAttributesForSamlRegisteredService(
        final Map<String, List<Object>> attributes,
        final SamlRegisteredServiceCachingMetadataResolver resolver,
        final SamlRegisteredServiceMetadataAdaptor facade,
        final EntityDescriptor entityDescriptor,
        final RegisteredServiceAttributeReleasePolicyContext context) {

        return ApplicationContextProvider.getScriptResourceCacheManager()
            .map(cacheMgr -> {
                val groovyResource = SpringExpressionLanguageValueResolver.getInstance().resolve(this.groovyScript);
                val script = cacheMgr.resolveScriptableResource(groovyResource, groovyResource);
                return Optional.ofNullable(script)
                    .map(Unchecked.function(sc -> {
                        val args = new Object[]{attributes, context.getRegisteredService(), resolver,
                            facade, entityDescriptor, context.getApplicationContext(), LOGGER};
                        return (Map<String, List<Object>>) script.execute(args, Map.class, true);
                    }))
                    .orElseGet(() -> {
                        LOGGER.warn("Groovy script [{}] does not exist or cannot be loaded", groovyScript);
                        return new HashMap<>();
                    });
            })
            .orElseThrow(() -> new RuntimeException("No groovy script cache manager is available to execute attribute mappings"));
    }
This is {@link GroovySamlRegisteredServiceAttributeReleasePolicy}.

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