Class DeniedPermission
- All Implemented Interfaces:
Serializable
,Guard
public final class DeniedPermission extends MetaPermission
A DeniedPermission
, when "granted" to some ProtectionDomain
, represents
a privilege which cannot be exercised, regardless of any positive permissions
(AllPermission
included) possessed (except for a GuaranteedPermission
). In other words, if
a set of granted permissions, P, contains a permission of this class, D, then the set of
effectively granted permissions is
{ Pimplied - Dimplied }.
Each instance of this class encapsulates a target permission, representing the "positive" permission being negated.
Denied permissions employ the following naming scheme:
<target_class_name>:<target_name>(:<target_actions>)
where:
- <target_class_name> is the fully qualified name of the target permission's class,
- <target_name> is the name of the target permission,
- (<target_actions>) is, optionally, the actions string of the target permission, and
- the ':' character stands for itself.
- p is not itself a denied permission, and
(t.implies(p) == true)
, or - p is a denied permission, with a target t1, and
(t.implies(t1) == true)
.
It is the responsibility of the policy decision point (e.g., the Policy
provider) to
take denied permission semantics into account when issuing authorization statements.
- See Also:
- Serialized Form
-
Field Summary
-
Method Summary
Modifier and Type Method Description static DeniedPermission
create(String targetClassName, String targetName, String targetActions)
Instantiates aDeniedPermission
that encapsulates a target permission of the indicated class, specified name and, optionally, actions.static DeniedPermission
create(Permission target)
Instantiates aDeniedPermission
that encapsulates the given target permission.boolean
implies(Permission p)
Checks whether the given permission is implied by this one, as per the overview.Methods inherited from class java.security.BasicPermission
equals, getActions, hashCode, newPermissionCollection
-
Method Details
-
create
@Permissions public static DeniedPermission create(String targetClassName, @Nullable String targetName, @Nullable String targetActions)Instantiates aDeniedPermission
that encapsulates a target permission of the indicated class, specified name and, optionally, actions.- Parameters:
targetClassName
- The name of the class of the Permission to be denied.targetName
- The target for the Permission to be denied.targetActions
- The actions (if any) to be specifically denied by the underlying class.- Throws:
IllegalArgumentException
- if:targetClassName
isnull
, the empty string, does not refer to a concretePermission
descendant, or refers toDeniedPermission.class
orUnresolvedPermission.class
.targetName
isnull
.targetClassName
cannot be instantiated, and it's the caller's fault; e.g., becausetargetName
and/ortargetActions
do not adhere to the naming constraints of the target class; or due to the target class not exposing a(String name)
, or(String name, String actions)
constructor, depending on whethertargetActions
isnull
or not.
SecurityException
- if aSecurityManager
,sm
, is installed, and the invocationsm.checkPackageAccess(targetClassPackageName)
(wheretargetClassPackageName
is the package of the class referred to bytargetClassName
) denies access.
-
create
Instantiates aDeniedPermission
that encapsulates the given target permission.- Parameters:
target
- The Permission that is being explicitly denied.- Throws:
IllegalArgumentException
- iftarget
isnull
, aDeniedPermission
, or anUnresolvedPermission
.
-
implies
Checks whether the given permission is implied by this one, as per the overview.- Overrides:
implies
in classMetaPermission
- Parameters:
p
- The Permission being checked.
-