java.lang.Object | |
↳ | java.security.Policy |
Policy
is the common super type of classes which represent a system
security policy. The Policy
specifies which permissions apply to
which code sources.
The system policy can be changed by setting the 'policy.provider'
property in the file named JAVA_HOME/lib/security/java.security
to
the fully qualified class name of the desired Policy
.
Only one instance of a Policy
is active at any time.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Policy.Parameters | A marker interface for Policy parameters. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
UNSUPPORTED_EMPTY_COLLECTION | A read-only empty PermissionCollection instance. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Answers a Policy object with the specified type and the specified
parameter.
| |||||||||||
Answers a Policy object of the specified type.
| |||||||||||
Answers a Policy object of the specified type.
| |||||||||||
Answers Policy parameters.
| |||||||||||
Returns a
PermissionCollection describing what permissions are
allowed for the specified CodeSource based on the current
security policy. | |||||||||||
Returns a
PermissionCollection describing what permissions are
allowed for the specified ProtectionDomain (more specifically,
its CodeSource ) based on the current security policy. | |||||||||||
Returns the current system security policy.
| |||||||||||
Answers the Provider of this Policy.
| |||||||||||
Answers the type of this Policy.
| |||||||||||
Indicates whether the specified
Permission is implied by the
PermissionCollection of the specified ProtectionDomain . | |||||||||||
Reloads the policy configuration for this
Policy instance. | |||||||||||
Sets the system wide policy.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
A read-only empty PermissionCollection instance.
Answers a Policy object with the specified type and the specified parameter. Traverses the list of registered security providers, beginning with the most preferred Provider. A new Policy object encapsulating the PolicySpi implementation from the first Provider that supports the specified type is returned. Note that the list of registered providers may be retrieved via the Security.getProviders() method.
type | the specified Policy type. See Appendix A in the Java Cryptography Architecture API Specification & Reference for a list of standard Policy types. |
---|---|
params | parameters for the Policy, which may be null. |
NoSuchAlgorithmException | if no Provider supports a PolicySpi implementation for the specified type. |
---|---|
SecurityException | if the caller does not have permission to get a Policy instance for the specified type. |
NullPointerException | if the specified type is null. |
IllegalArgumentException | if the specified parameters' type are not allowed by the PolicySpi implementation from the selected Provider. |
Answers a Policy object of the specified type. A new Policy object encapsulating the PolicySpi implementation from the specified provider is returned. The specified provider must be registered in the provider list via the Security.getProviders() method, otherwise NoSuchProviderException will be thrown.
type | the specified Policy type. So far in Java 6, only 'JavaPolicy' supported. |
---|---|
params | the Policy.Parameter object, which may be null. |
provider | the provider. |
NoSuchProviderException | if the specified provider is not registered in the security provider list. |
---|---|
NoSuchAlgorithmException | if the specified provider does not support a PolicySpi implementation for the specified type. |
SecurityException | if the caller does not have permission to get a Policy instance for the specified type. |
NullPointerException | if the specified type is null. |
IllegalArgumentException | if the specified Provider is null, or if the specified parameters' type are not allowed by the PolicySpi implementation from the specified Provider. |
Answers a Policy object of the specified type. A new Policy object encapsulating the PolicySpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list.
type | the specified Policy type. So far in Java 6, only 'JavaPolicy' supported. |
---|---|
params | the Policy.Parameter object, which may be null. |
provider | the Policy service Provider. |
NoSuchAlgorithmException | if the specified Provider does not support a PolicySpi implementation for the specified type. |
---|---|
IllegalArgumentException | if the specified Provider is null, or if the specified parameters' type are not allowed by the PolicySpi implementation from the specified Provider. |
NullPointerException | if the specified type is null. |
SecurityException | if the caller does not have permission to get a Policy instance for the specified type. |
Answers Policy parameters. This method will only answer non-null parameters if it was obtained via a call to Policy.getInstance. Otherwise this method returns null.
Returns a PermissionCollection
describing what permissions are
allowed for the specified CodeSource
based on the current
security policy.
Note that this method is not called for classes which are in the system domain (i.e. system classes). System classes are always given full permissions (i.e. AllPermission). This can not be changed by installing a new policy.
cs | the CodeSource to compute the permissions for. |
---|
CodeSource
.
Returns a PermissionCollection
describing what permissions are
allowed for the specified ProtectionDomain
(more specifically,
its CodeSource
) based on the current security policy.
Note that this method is not< called for classes which are in the system domain (i.e. system classes). System classes are always given full permissions (i.e. AllPermission). This can not be changed by installing a new policy.
domain | the ProtectionDomain to compute the permissions for. |
---|
CodeSource
.
Returns the current system security policy. If no policy has been
instantiated then this is done using the security property "policy.provider"
.
If a SecurityManager
is installed, code calling this method needs
the SecurityPermission
getPolicy
to be granted, otherwise
a SecurityException
will be thrown.
SecurityException | if a SecurityManager is installed and the caller does
not have permission to invoke this method.
|
---|
Answers the Provider of this Policy. This method will only answer non-null Provider if it was obtained via a call to Policy.getInstance. Otherwise this method returns null.
Answers the type of this Policy. This method will only answer non-null type if it was obtained via a call to Policy.getInstance. Otherwise this method returns null.
Indicates whether the specified Permission
is implied by the
PermissionCollection
of the specified ProtectionDomain
.
domain | the ProtectionDomain for which the permission should
be granted. |
---|---|
permission | the Permission for which authorization is to be
verified. |
true
if the Permission
is implied by the ProtectionDomain
, false
otherwise.
Reloads the policy configuration for this Policy
instance.
Sets the system wide policy.
If a SecurityManager
is installed, code calling this method needs
the SecurityPermission
setPolicy
to be granted, otherwise
a SecurityException
will be thrown.
policy | the Policy to set. |
---|
SecurityException | if a SecurityManager is installed and the caller does
not have permission to invoke this method.
|
---|