Class FreeMarkerPermission

All Implemented Interfaces:
Serializable, Guard

public class FreeMarkerPermission extends BasicPermission
A class representing all FreeMarker-related permissions. Currently available permissions are:
modifyTemplate Permits invocation of various template methods that can be used to modify the template in such a way as to breach security. Specifically, Template.getRootTreeNode(), TemplateCore.getMacros(), Template.setParent(Configurable), and Template.containingElements(int, int).
setSecure Permits invocation of Configuration.setSecure(boolean) with false argument (thus turning off security of a secure configuration).
setScriptEngineConfiguration Permits invocation of FreeMarkerScriptEngine.setConfiguration(freemarker.template.Configuration) or specifying a configuration object within the engine's bindings under name FreeMarkerScriptConstants.CONFIGURATION.
setScriptEngineFactoryConfiguration Permits invocation of FreeMarkerScriptEngineFactory.setConfiguration(freemarker.template.Configuration).
setTemplateLoader Permits setting an arbitrary template loader using Configuration.setTemplateLoader(freemarker.cache.TemplateLoader). Note that various setXxxForTemplateLoading() methods are not checked for this permission, as they internally all create trusted template loaders.
See Also:
  • Constructor Details

    • FreeMarkerPermission

      public FreeMarkerPermission(String name)
  • Method Details

    • checkPermission

      public static void checkPermission(Configuration config, Permission permission)
      Checks a permission if there is a SecurityManager installed in the JVM and the Configuration's isSecure() returns true.
      Parameters:
      config - the configuration that is checked for being secured.
      permission - the permission to check
      Throws:
      SecurityException - if the permission check fails.
    • checkPermission

      public static void checkPermission(Permission permission)
      Checks a permission if there is a SecurityManager installed in the JVM.
      Parameters:
      permission - the permission to check
      Throws:
      SecurityException - if the permission check fails.