private static String getScriptedPatternedValue(final Object currentValue,
                                                    final String patternedValue,
                                                    final AttributeDefinitionResolutionContext context) {

        val scriptFactory = ExecutableCompiledScriptFactory.findExecutableCompiledScriptFactory();
        if (scriptFactory.isPresent() && scriptFactory.get().isInlineScript(patternedValue)) {
            return ApplicationContextProvider.getScriptResourceCacheManager()
                .map(cacheManager -> FunctionUtils.doUnchecked(() -> {
                    val script = cacheManager.resolveScriptableResource(patternedValue);
                    val args = CollectionUtils.<String, Object>wrap("context", context,
                        "currentValue", currentValue, "logger", LOGGER);
                    script.setBinding(args);
                    return script.execute(args.values().toArray(), String.class);
                }))
                .orElse(patternedValue);
        }
        return patternedValue;
    }
This is {@link DefaultAttributeDefinition}.

@author Misagh Moayyed
@author Travis Schmidt
@since 6.2.0
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/attribute/DefaultAttributeDefinition.java