|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.jexl3.introspection.JexlSandbox
public final class JexlSandbox
A sandbox describes permissions on a class by explicitly allowing or forbidding access to methods and properties through "whitelists" and "blacklists".
A whitelist explicitly allows methods/properties for a class;
A blacklist explicitly forbids methods/properties for a class;
Permissions are composed of three lists, read, write, execute, each being "white" or "black":
Note that a JexlUberspect always uses a copy of the JexlSandbox used to built it to avoid synchronization and/or concurrent modifications at runtime.
Nested Class Summary | |
---|---|
static class |
JexlSandbox.BlackSet
A black set of names. |
static class |
JexlSandbox.Names
A base set of names. |
static class |
JexlSandbox.Permissions
Contains the white or black lists for properties and methods for a given class. |
static class |
JexlSandbox.WhiteSet
A white set of names. |
Constructor Summary | |
---|---|
|
JexlSandbox()
Creates a new default sandbox. |
|
JexlSandbox(boolean wb)
Creates a new default sandbox. |
protected |
JexlSandbox(boolean wb,
Map<String,JexlSandbox.Permissions> map)
Creates a sandbox based on an existing permissions map. |
protected |
JexlSandbox(Map<String,JexlSandbox.Permissions> map)
Creates a sandbox based on an existing permissions map. |
Method Summary | |
---|---|
JexlSandbox.Permissions |
black(String clazz)
Creates a new set of permissions based on black lists for methods and properties for a given class. |
JexlSandbox |
copy()
|
String |
execute(Class<?> clazz,
String name)
Gets the execute permission value for a given method of a class. |
String |
execute(String clazz,
String name)
Gets the execute permission value for a given method of a class. |
JexlSandbox.Permissions |
get(String clazz)
Gets the set of permissions associated to a class. |
JexlSandbox.Permissions |
permissions(String clazz,
boolean readFlag,
boolean writeFlag,
boolean executeFlag)
Creates the set of permissions for a given class. |
String |
read(Class<?> clazz,
String name)
Gets the read permission value for a given property of a class. |
String |
read(String clazz,
String name)
Gets the read permission value for a given property of a class. |
JexlSandbox.Permissions |
white(String clazz)
Creates a new set of permissions based on white lists for methods and properties for a given class. |
String |
write(Class<?> clazz,
String name)
Gets the write permission value for a given property of a class. |
String |
write(String clazz,
String name)
Gets the write permission value for a given property of a class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JexlSandbox()
In the absence of explicit permissions on a class, the sandbox is a white-box, white-listing that class for all permissions (read, write and execute).
public JexlSandbox(boolean wb)
A white-box considers no permissions as "everything is allowed" when a black-box considers no permissions as "nothing is allowed".
wb
- whether this sandbox is white (true) or black (false)
if no permission is explicitly defined for a class.protected JexlSandbox(Map<String,JexlSandbox.Permissions> map)
map
- the permissions mapprotected JexlSandbox(boolean wb, Map<String,JexlSandbox.Permissions> map)
wb
- whether this sandbox is white (true) or black (false)map
- the permissions mapMethod Detail |
---|
public JexlSandbox copy()
public String read(Class<?> clazz, String name)
clazz
- the classname
- the property name
public String read(String clazz, String name)
clazz
- the class namename
- the property name
public String write(Class<?> clazz, String name)
clazz
- the classname
- the property name
public String write(String clazz, String name)
clazz
- the class namename
- the property name
public String execute(Class<?> clazz, String name)
clazz
- the classname
- the method name
public String execute(String clazz, String name)
clazz
- the class namename
- the method name
public JexlSandbox.Permissions permissions(String clazz, boolean readFlag, boolean writeFlag, boolean executeFlag)
clazz
- the class for which these permissions applyreadFlag
- whether the readable property list is white - true - or black - false -writeFlag
- whether the writable property list is white - true - or black - false -executeFlag
- whether the executable method list is white white - true - or black - false -
public JexlSandbox.Permissions white(String clazz)
clazz
- the whitened class name
public JexlSandbox.Permissions black(String clazz)
clazz
- the blackened class name
public JexlSandbox.Permissions get(String clazz)
clazz
- the class name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |