Class SecurityQueryTemplateEvaluator

java.lang.Object
org.elasticsearch.xpack.core.security.authz.support.SecurityQueryTemplateEvaluator

public final class SecurityQueryTemplateEvaluator extends Object
Helper class that helps to evaluate the query source template.
  • Method Details

    • evaluateTemplate

      public static String evaluateTemplate(String querySource, ScriptService scriptService, User user)
      If the query source is a template, then parses the script, compiles the script with user details parameters and then executes it to return the query string.

      Note: This method always enforces "mustache" script language for the template.

      Parameters:
      querySource - query string template to be evaluated.
      scriptService - ScriptService
      user - User details for user defined parameters in the script.
      Returns:
      resultant query string after compiling and executing the script. If the source does not contain template then it will return the query source without any modifications.
    • wrap