Class TrialPolicy.Permission
- java.lang.Object
-
- java.security.Permission
-
- org.postgresql.pljava.policy.TrialPolicy.Permission
-
- All Implemented Interfaces:
Serializable
,Guard
- Enclosing class:
- TrialPolicy
public static final class TrialPolicy.Permission extends Permission
A permission likejava.security.AllPermission
, but without anyFilePermission
(the real policy's sandboxed/unsandboxed grants should handle those), nor a couple dozen varieties ofRuntimePermission
,SecurityPermission
, andReflectPermission
that would typically not be granted without clear intent.This permission can be granted in a
TrialPolicy
while identifying any straggling permissions needed by some existing code, without quite the excitement of grantingAllPermission
. Any of the permissions excluded from this one can also be granted in theTrialPolicy
, of course, if there is reason to believe the code might need them.The proper spelling in a policy file is
org.postgresql.pljava.policy.TrialPolicy$Permission
.This permission will probably only work right in a
TrialPolicy
. Any permission whoseimplies
method can return true for permissions of other classes than its own may be ineffective in a stock Java policy, where permission collections are kept segregated by the class of the permission to be checked. Java'sAllPermission
gets special-case treatment in the stock implementation, and this permission likewise has to be treated specially inTrialPolicy
. The only kind of custom permission that can genuinely drop in and work is one whoseimplies
method only imposes semantics on the names/actions of different instances of that permission class.A permission that does not live on the boot classpath is initially read from a policy file as an instance of
UnresolvedPermission
, and only gets resolved when a permission check is made, checking for an instance of its actual class. That is another complication when implementing a permission that may imply permissions of other classes.A permission implemented in a different named module must be in a package that is exported to
java.base
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Permission()
Permission(String name, String actions)
-
Method Summary
Modifier and Type Method Description boolean
equals(Object other)
String
getActions()
int
hashCode()
boolean
implies(Permission p)
PermissionCollection
newPermissionCollection()
-
Methods inherited from class java.security.Permission
checkGuard, getName, toString
-
-
-
-
Method Detail
-
equals
public boolean equals(Object other)
- Specified by:
equals
in classPermission
-
hashCode
public int hashCode()
- Specified by:
hashCode
in classPermission
-
getActions
public String getActions()
- Specified by:
getActions
in classPermission
-
newPermissionCollection
public PermissionCollection newPermissionCollection()
- Overrides:
newPermissionCollection
in classPermission
-
implies
public boolean implies(Permission p)
- Specified by:
implies
in classPermission
-
-