ProtectionDomain class encapsulates the characteristics of a
domain, which encloses a set of classes whose instances are granted a set
of permissions.
A static set of permissions can be bound to a ProtectionDomain
when it is constructed; such permissions are granted to the domain
regardless of the policy in force. However, to support dynamic security
policies, a ProtectionDomain can also be constructed such that it
is dynamically mapped to a set of permissions by the current policy.
API Note
Installing a system-wide Policy object is
no longer supported. The current policy
is always a Policy object that grants no permissions.
| Modifier and Type | Field and Description |
|---|---|
| private final ClassLoader | |
| private final CodeSource | |
| private boolean | |
| private PermissionCollection | |
| private final Principal[] | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | ProtectionDomain(CodeSource
the codesource associated with this domain codesource, PermissionCollection the permissions granted to this domain permissions)Creates a new |
| public | ProtectionDomain(CodeSource
the codesource, PermissionCollection CodeSource associated with this domainthe permissions granted to this domain permissions, ClassLoader the classloader, Principal[] ClassLoader associated with this domainthe array of principals)Principal objects associated
with this domain. The contents of the array are copied to protect against
subsequent modification.Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public final ClassLoader | Returns: theClassLoader of this domain which may be null.Returns the |
| public final CodeSource | Returns: theCodeSource of this domain which may be null.Returns the |
| public final PermissionCollection | Returns: the static set of permissions for this domain which may benull.Returns the static permissions granted to this domain. |
| public final Principal[] | Returns: a non-null array of principals for this domain. Returns a new array each time this method is called.Returns an array of principals for this domain. |
| public boolean | Returns: true if perm is implied by this
ProtectionDomain.the perm)Permission object to check.Check and see if this |
| public final boolean | Returns: true if this domain contains only static permissions.Returns |
| public String |
| classloader | back to summary |
|---|---|
| private final ClassLoader classloader | |
| codesource | back to summary |
|---|---|
| private final CodeSource codesource | |
| hasAllPerm | back to summary |
|---|---|
| private boolean hasAllPerm | |
| permissions | back to summary |
|---|---|
| private PermissionCollection permissions | |
| principals | back to summary |
|---|---|
| private final Principal[] principals | |
| staticPermissions | back to summary |
|---|---|
| private final boolean staticPermissions | |
| ProtectionDomain | back to summary |
|---|---|
| public ProtectionDomain(CodeSource codesource, PermissionCollection permissions) Creates a new
The permissions granted to this domain are static, i.e.
invoking the API Note Installing a system-wide
| |
| ProtectionDomain | back to summary |
|---|---|
| public ProtectionDomain(CodeSource codesource, PermissionCollection permissions, ClassLoader classloader, Principal[] principals) Creates a new
The permissions granted to this domain are dynamic, i.e.
invoking the API Note Installing a system-wide
| |
| getClassLoader | back to summary |
|---|---|
| public final ClassLoader getClassLoader() Returns the
| |
| getCodeSource | back to summary |
|---|---|
| public final CodeSource getCodeSource() Returns the
| |
| getPermissions | back to summary |
|---|---|
| public final PermissionCollection getPermissions() Returns the static permissions granted to this domain.
| |
| getPrincipals | back to summary |
|---|---|
| public final Principal[] getPrincipals() Returns an array of principals for this domain.
| |
| implies | back to summary |
|---|---|
| public boolean implies(Permission perm) Check and see if this
The set of permissions evaluated is a function of whether the
If the
Otherwise, the permission will be checked against the combination
of the API Note Installing a system-wide
| |
| staticPermissionsOnly | back to summary |
|---|---|
| public final boolean staticPermissionsOnly() Returns API Note Installing a system-wide
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Convert a
| |