Package com.illumon.iris.security
Class GuaranteedPermission
java.lang.Object
java.security.Permission
java.security.BasicPermission
com.illumon.iris.security.MetaPermission
com.illumon.iris.security.GuaranteedPermission
- All Implemented Interfaces:
Serializable
,Guard
public class GuaranteedPermission extends MetaPermission
A custom Java security Permission that overrides a DeniedPermission, ensuring that a given property can be accessed
even if otherwise denied or not granted.
- See Also:
- Serialized Form
-
Field Summary
-
Method Summary
Modifier and Type Method Description boolean
implies(Permission p)
Checks whether the given permission is implied by this one, as per the overview.static GuaranteedPermission
newGuaranteedPermission(String targetClassName, String targetName, String targetActions)
Instantiates aGuaranteedPermission
that encapsulates a target permission of the indicated class, specified name and, optionally, actions.static GuaranteedPermission
newGuaranteedPermission(Permission target)
Instantiates aGuaranteedPermission
that encapsulates the given target permission.Methods inherited from class java.security.BasicPermission
equals, getActions, hashCode, newPermissionCollection
-
Method Details
-
newGuaranteedPermission
@Permissions public static GuaranteedPermission newGuaranteedPermission(String targetClassName, @Nullable String targetName, @Nullable String targetActions)Instantiates aGuaranteedPermission
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 allowed (even if otherwise denied).targetName
- The target for the Permission to be allowed.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 to anyMetaPermission.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.
-
newGuaranteedPermission
Instantiates aGuaranteedPermission
that encapsulates the given target permission.- Parameters:
target
- The Permission that is being explicitly permitted (even if otherwise denied).- Throws:
IllegalArgumentException
- iftarget
isnull
, aMetaPermission
, 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.
-