public final class Sandbox extends Object
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":
| Modifier and Type | Class and Description |
|---|---|
static class |
Sandbox.BlackSet
A black set of names.
|
static class |
Sandbox.Names
A base set of names.
|
static class |
Sandbox.Permissions
Contains the white or black lists for properties and methods for a given class.
|
static class |
Sandbox.WhiteSet
A white set of names.
|
| Modifier | Constructor and Description |
|---|---|
|
Sandbox()
Creates a new default sandbox.
|
protected |
Sandbox(Map<String,Sandbox.Permissions> map)
Creates a sandbox based on an existing permissions map.
|
| Modifier and Type | Method and Description |
|---|---|
Sandbox.Permissions |
black(String clazz)
Creates a new set of permissions based on black lists for methods and properties for a given class.
|
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.
|
Sandbox.Permissions |
get(String clazz)
Gets the set of permissions associated to a class.
|
Sandbox.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.
|
Sandbox.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.
|
public Sandbox()
protected Sandbox(Map<String,Sandbox.Permissions> map)
map - the permissions mappublic String read(Class<?> clazz, String name)
clazz - the classname - the property namepublic String read(String clazz, String name)
clazz - the class namename - the property namepublic String write(Class<?> clazz, String name)
clazz - the classname - the property namepublic String write(String clazz, String name)
clazz - the class namename - the property namepublic String execute(Class<?> clazz, String name)
clazz - the classname - the method namepublic String execute(String clazz, String name)
clazz - the class namename - the method namepublic Sandbox.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 writeable property list is white - true - or black - false -executeFlag - whether the executable method list is white white - true - or black - false -public Sandbox.Permissions white(String clazz)
clazz - the whitened class namepublic Sandbox.Permissions black(String clazz)
clazz - the blackened class namepublic Sandbox.Permissions get(String clazz)
clazz - the class nameCopyright © 2020 Internet2. All rights reserved.