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 DeniedPermissioncreate(String targetClassName, String targetName, String targetActions)Instantiates aDeniedPermissionthat encapsulates a target permission of the indicated class, specified name and, optionally, actions.static DeniedPermissioncreate(Permission target)Instantiates aDeniedPermissionthat encapsulates the given target permission.booleanimplies(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 aDeniedPermissionthat 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:targetClassNameisnull, the empty string, does not refer to a concretePermissiondescendant, or refers toDeniedPermission.classorUnresolvedPermission.class.targetNameisnull.targetClassNamecannot be instantiated, and it's the caller's fault; e.g., becausetargetNameand/ortargetActionsdo 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 whethertargetActionsisnullor not.
SecurityException- if aSecurityManager,sm, is installed, and the invocationsm.checkPackageAccess(targetClassPackageName)(wheretargetClassPackageNameis the package of the class referred to bytargetClassName) denies access.
-
create
Instantiates aDeniedPermissionthat encapsulates the given target permission.- Parameters:
target- The Permission that is being explicitly denied.- Throws:
IllegalArgumentException- iftargetisnull, aDeniedPermission, or anUnresolvedPermission.
-
implies
Checks whether the given permission is implied by this one, as per the overview.- Overrides:
impliesin classMetaPermission- Parameters:
p- The Permission being checked.
-