The basic functionality is that nothing (except for a base set of permissions) is allowed, unless the permission is granted either explicitly or implicitly. If a permission is granted this can be overruled by explicitly revoking the permission. It is not permissible to add permissions (either granted or revoked) while the Security Manager is active (after calling setSecurityManager() but before calling restoreSecurityManager()).
Note
This class isn't supported in Java 18 and higher where SecurityManager
has been
deprecated for removal.
Modifier and Type | Class and Description |
---|---|
private class | Permissions.MySM
Deprecated
as a consequence of This inner class implements the actual SecurityManager that can be used by tasks
supporting Permissions.
SecurityManager being deprecated.
|
public static class | Permissions.Permission
Represents a permission. |
Modifier and Type | Field and Description |
---|---|
private boolean | |
private final boolean | |
private Permissions | |
private final List | |
private SecurityManager | origSm
Deprecated
as a consequence of
SecurityManager being deprecated.
|
private static final Class | |
private final List |
Access | Constructor and Description |
---|---|
public | |
public | Permissions(final boolean
if delegateToOldSM)true the old security manager
will be used if the permission has not been explicitly granted or revoked
in this instance.Create a set of permissions. |
Modifier and Type | Method and Description |
---|---|
public void | addConfiguredGrant(final Permissions.
The Permissions.Permission to be granted. permAdds a permission to be granted. |
public void | addConfiguredRevoke(final Permissions.
The Permissions.Permission to be revoked permAdds a permission to be revoked. |
private Permission | |
private void | |
public synchronized void | restoreSecurityManager()
To be used by tasks that just finished executing the parts subject to these permissions. |
public synchronized void | setSecurityManager()
To be used by tasks wishing to use this security model before executing the part to be subject to these Permissions. |
active | back to summary |
---|---|
private boolean active |
delegateToOldSM | back to summary |
---|---|
private final boolean delegateToOldSM |
granted | back to summary |
---|---|
private Permissions granted |
grantedPermissions | back to summary |
---|---|
private final List<Permissions. |
origSm | back to summary |
---|---|
private SecurityManager origSm
Deprecated as a consequence of |
PARAMS | back to summary |
---|---|
private static final Class<?>[] PARAMS |
revokedPermissions | back to summary |
---|---|
private final List<Permissions. |
Permissions | back to summary |
---|---|
public Permissions() Create a set of Permissions. Equivalent to calling
|
Permissions | back to summary |
---|---|
public Permissions(final boolean delegateToOldSM) Create a set of permissions.
|
addConfiguredGrant | back to summary |
---|---|
public void addConfiguredGrant(final Permissions. Adds a permission to be granted.
|
addConfiguredRevoke | back to summary |
---|---|
public void addConfiguredRevoke(final Permissions. Adds a permission to be revoked.
|
createPermission | back to summary |
---|---|
private Permission createPermission(final Permissions. |
init | back to summary |
---|---|
private void init() throws BuildException Initializes the list of granted permissions, checks the list of revoked permissions. |
restoreSecurityManager | back to summary |
---|---|
public synchronized void restoreSecurityManager() throws BuildException To be used by tasks that just finished executing the parts subject to these permissions.
This method is no longer supported in Java 18 and higher versions and throws a
|
setSecurityManager | back to summary |
---|---|
public synchronized void setSecurityManager() throws BuildException To be used by tasks wishing to use this security model before executing the part to be subject to these Permissions. Note that setting the SecurityManager too early may prevent your part from starting, as for instance changing classloaders may be prohibited. The classloader for the new situation is supposed to be present.
This method is no longer supported in Java 18 and higher versions and throws a
|
Deprecated
as a consequence of SecurityManager
being deprecated. See corresponding docs for further information.
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public void | checkExit(final int
The exit status requested. status)Overrides java. |
public void | checkPermission(final Permission
The permission requested. perm)Overrides java. |
private void | checkRevoked(final Permission
the permission being checked perm)throws an exception if this permission is revoked |
MySM | back to summary |
---|---|
private MySM() |
checkExit | back to summary |
---|---|
public void checkExit(final int status) Overrides java. Exit is treated in a special way in order to be able to return the exit code towards tasks. An ExitException is thrown instead of a simple SecurityException to indicate the exit code. Overridden from java.lang.SecurityManager
|
checkPermission | back to summary |
---|---|
public void checkPermission(final Permission perm) Overrides java. The central point in checking permissions. Overridden from java.lang.SecurityManager
|
checkRevoked | back to summary |
---|---|
private void checkRevoked(final Permission perm) throws an exception if this permission is revoked
|
Modifier and Type | Field and Description |
---|---|
private Set | |
private String | |
private String | |
private String |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public String | |
public String | |
public String | |
pack-priv boolean | matches(final Permission
The permission to check against. perm)Learn whether the permission matches in case of a revoked permission. |
private Set | parseActions(final String
The actions to be parsed. actions)Parses the actions into a set of separate strings. |
public void | |
public void | |
public void | |
public String | Returns: string description of the permissions.Overrides java. |
actions | back to summary |
---|---|
private Set<String> actions |
actionString | back to summary |
---|---|
private String actionString |
className | back to summary |
---|---|
private String className |
name | back to summary |
---|---|
private String name |
Permission | back to summary |
---|---|
public Permission() |
getActions | back to summary |
---|---|
public String getActions() Get the actions.
|
getClassName | back to summary |
---|---|
public String getClassName() Get the class of the permission.
|
getName | back to summary |
---|---|
public String getName() Get the name of the permission.
|
matches | back to summary |
---|---|
pack-priv boolean matches(final Permission perm) Learn whether the permission matches in case of a revoked permission.
|
parseActions | back to summary |
---|---|
private Set Parses the actions into a set of separate strings.
|
setActions | back to summary |
---|---|
public void setActions(final String actions) Set the actions.
|
setClass | back to summary |
---|---|
public void setClass(final String aClass) Set the class, mandatory.
|
setName | back to summary |
---|---|
public void setName(final String aName) Set the name of the permission.
|
toString | back to summary |
---|---|
public String toString() Overrides java. Get a string description of the permissions. |