Package freemarker.core
Class FreeMarkerPermission
- java.lang.Object
-
- java.security.Permission
-
- java.security.BasicPermission
-
- freemarker.core.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), andTemplate.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 nameFreeMarkerScriptConstants.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FreeMarkerPermission(String name)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckPermission(Configuration config, Permission permission)Checks a permission if there is a SecurityManager installed in the JVM and the Configuration's isSecure() returns true.static voidcheckPermission(Permission permission)Checks a permission if there is a SecurityManager installed in the JVM.-
Methods inherited from class java.security.BasicPermission
equals, getActions, hashCode, implies, newPermissionCollection
-
Methods inherited from class java.security.Permission
checkGuard, getName, toString
-
-
-
-
Constructor Detail
-
FreeMarkerPermission
public FreeMarkerPermission(String name)
-
-
Method Detail
-
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.
-
-