protected String buildScriptedAuthnContextClassRef(final SamlProfileBuilderContext context, final String requiredClass) {
        LOGGER.debug("Executing groovy script [{}] to determine authentication context class for [{}]",
            requiredClass, context.getAdaptor().getEntityId());
        return scriptResourceCacheManager
            .stream()
            .map(cacheMgr -> {
                val script = cacheMgr.resolveScriptableResource(requiredClass,
                    requiredClass, context.getAdaptor().getEntityId());
                return FunctionUtils.doIfNotNull(script,
                    () -> {
                        val args = CollectionUtils.wrap("context", context, "logger", LOGGER);
                        script.setBinding(args);
                        return script.execute(args.values().toArray(), String.class, true);
                    },
                    () -> requiredClass).get();
            })
            .findFirst()
            .orElseThrow(() -> new RuntimeException("Unable to locate script cache manager or execute groovy script"));
    }
This is {@link SamlProfileAuthnContextClassRefBuilder}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/authn/SamlProfileAuthnContextClassRefBuilder.java