Package org.pkl.core
Class SecurityManagers
java.lang.Object
org.pkl.core.SecurityManagers
A provider for
SecurityManagers.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionReturns the list of module patterns that thedefault security managerwill use to determine if a module import may be resolved.Returns the list of resource patterns that thedefault security managerwill use to determine if an external resource may be read.static final SecurityManagerReturns astandard security managerwithdefault allowed modules,default allowed resources,default trust levels, and no root directory for modules and resources.Returns the mapping from module URIs to trust levels used by thedefault security manager. -
Method Summary
Modifier and TypeMethodDescriptionstatic SecurityManagerstandard(List<Pattern> allowedModules, List<Pattern> allowedResources, Function<URI, Integer> trustLevels, @Nullable 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.Creates an unconfigured builder for setting up a standardSecurityManager.
-
Field Details
-
defaultAllowedModules
Returns the list of module patterns that thedefault security managerwill use to determine if a module import may be resolved. -
defaultAllowedResources
Returns the list of resource patterns that thedefault security managerwill use to determine if an external resource may be read. -
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
Returns astandard security managerwithdefault allowed modules,default allowed resources,default trust levels, and no root directory for modules and resources.
-
-
Method Details
-
standard
public static SecurityManager standard(List<Pattern> allowedModules, List<Pattern> allowedResources, Function<URI, Integer> trustLevels, @Nullable @Nullable 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
Creates an unconfigured builder for setting up a standardSecurityManager.
-