Package org.pkl.core
Class SecurityManagers
- java.lang.Object
-
- org.pkl.core.SecurityManagers
-
public final class SecurityManagers extends java.lang.ObjectA provider forSecurityManagers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSecurityManagers.StandardBuilder
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<java.util.regex.Pattern>defaultAllowedModulesReturns the list of module patterns that thedefault security managerwill use to determine if a module import may be resolved.static java.util.List<java.util.regex.Pattern>defaultAllowedResourcesReturns the list of resource patterns that thedefault security managerwill use to determine if an external resource may be read.static SecurityManagerdefaultManagerReturns astandard security managerwithdefault allowed modules,default allowed resources,default trust levels, and no root directory for modules and resources.static java.util.function.Function<java.net.URI,java.lang.Integer>defaultTrustLevelsReturns the mapping from module URIs to trust levels used by thedefault security manager.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SecurityManagerstandard(java.util.List<java.util.regex.Pattern> allowedModules, java.util.List<java.util.regex.Pattern> allowedResources, java.util.function.Function<java.net.URI,java.lang.Integer> trustLevels, @Nullable java.nio.file.Path rootDir)Creates aSecurityManagerthat determines whether a module can be resolved based on the given list of module URI patterns, whether an external resources can be read based on the given list of resource URI patterns, and whether a module can import another module based on the given module trust levels.static SecurityManagers.StandardBuilderstandardBuilder()Creates an unconfigured builder for setting up a standardSecurityManager.
-
-
-
Field Detail
-
defaultAllowedModules
public static final java.util.List<java.util.regex.Pattern> defaultAllowedModules
Returns the list of module patterns that thedefault security managerwill use to determine if a module import may be resolved.
-
defaultAllowedResources
public static final java.util.List<java.util.regex.Pattern> defaultAllowedResources
Returns the list of resource patterns that thedefault security managerwill use to determine if an external resource may be read.
-
defaultTrustLevels
public static final java.util.function.Function<java.net.URI,java.lang.Integer> defaultTrustLevels
Returns the mapping from module URIs to trust levels used by thedefault security manager.Trust levels are used to determine whether a module may import another module. Only modules with the same or a lower trust level may be imported.
This mapping supports a fixed set of module URI schemes. Local modules are given a higher trust level than remote modules. For example, a local file may import a remote file, but not the other way around.
-
defaultManager
public static final SecurityManager defaultManager
Returns astandard security managerwithdefault allowed modules,default allowed resources,default trust levels, and no root directory for modules and resources.
-
-
Method Detail
-
standard
public static SecurityManager standard(java.util.List<java.util.regex.Pattern> allowedModules, java.util.List<java.util.regex.Pattern> allowedResources, java.util.function.Function<java.net.URI,java.lang.Integer> trustLevels, @Nullable java.nio.file.Path rootDir)
Creates aSecurityManagerthat determines whether a module can be resolved based on the given list of module URI patterns, whether an external resources can be read based on the given list of resource URI patterns, and whether a module can import another module based on the given module trust levels. A module can only import modules with the same or a lower trust level.If
rootDiris non-null, access to file-based modules and resources is restricted to those located underrootDir. Any symlinks are resolved before this check is performed.
-
standardBuilder
public static SecurityManagers.StandardBuilder standardBuilder()
Creates an unconfigured builder for setting up a standardSecurityManager.
-
-