public static Predicate<Credential> newCredentialSelectionPredicate(final String selectionCriteria) {
        try {
            if (StringUtils.isBlank(selectionCriteria)) {
                return credential -> true;
            }
            val scriptFactoryInstance = ExecutableCompiledScriptFactory.findExecutableCompiledScriptFactory();
            if (scriptFactoryInstance.isPresent() && scriptFactoryInstance.get().isExternalScript(selectionCriteria) && CasRuntimeHintsRegistrar.notInNativeImage()) {
                val loader = new DefaultResourceLoader();
                val resource = loader.getResource(selectionCriteria);
                try (val is = resource.getInputStream()) {
                    val script = IOUtils.toString(is, StandardCharsets.UTF_8);
                    val scriptFactory = scriptFactoryInstance.get();
                    return scriptFactory.newObjectInstance(script, Predicate.class);
                }
            }
            val predicateClazz = ClassUtils.getClass(selectionCriteria);
            return (Predicate<Credential>) predicateClazz.getDeclaredConstructor().newInstance();
        } catch (final Exception e) {
            val predicate = Pattern.compile(selectionCriteria).asPredicate();
            return credential -> predicate.test(credential.getId());
        }
    }
Gets credential selection predicate.

@param selectionCriteria the selection criteria
@return the credential selection predicate
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/CoreAuthenticationUtils.java