Class ISPolicy
- java.lang.Object
-
- java.security.Policy
-
- com.sun.identity.policy.jaas.ISPolicy
-
public class ISPolicy extends Policy
This is an implementation of abstract classjava.security.Policyfor representing the system security policy for a Java application environment. It provides a custom policy implementation based on JAAS and JDK 1.5 and above.It makes policy evaluation against the OpenAM Policy Service instead of the default file based one.It provides implementation of the abstract methods in Policy class.
In general the source location for the policy information utilized by the Policy object to make policy decisions is up to the Policy implementation. In the case of ISPolicy the source comes from the OpenAM's policy store, which is consulted to make the policy evaluation.
A
Policyobject can be queried for the set of Permissions granted to set of classes running as aPrincipalin the following manner:policy = Policy.getPolicy(); PermissionCollection perms = policy.getPermissions(ProtectionDomain);
ThePolicyobject consults the local policy and returns the appropriatePermissionCollectionobjectISPermissionCollectioncontaining the Permissions granted to the Principals and granted to the set of classes specified by the providedprotectionDomain.The currently-installed Policy object can be obtained by calling the
getPolicymethod, and it can be changed by a call to thesetPolicymethod (by code with permission to reset the Policy).The
refreshmethod causes the policy object to refresh/reload its current configuration.- See Also:
ProtectionDomain,PermissionCollection
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.security.Policy
Policy.Parameters
-
-
Field Summary
-
Fields inherited from class java.security.Policy
UNSUPPORTED_EMPTY_COLLECTION
-
-
Constructor Summary
Constructors Constructor Description ISPolicy()Constructs anISPolicyinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PermissionCollectiongetPermissions(CodeSource codesource)Evaluates the global policy and returns aPermissionCollectionobject specifying the set of permissions allowed for Principals associated with the specified code source.PermissionCollectiongetPermissions(ProtectionDomain protectionDomain)Evaluates the global policy and returns aPermissionCollectionobject specifying the set of permissions allowed for Principals associated with the enclosed set of classes.voidrefresh()Refreshes/reloads the policy configuration.-
Methods inherited from class java.security.Policy
getInstance, getInstance, getInstance, getParameters, getPolicy, getProvider, getType, implies, setPolicy
-
-
-
-
Method Detail
-
getPermissions
public PermissionCollection getPermissions(ProtectionDomain protectionDomain)
Evaluates the global policy and returns aPermissionCollectionobject specifying the set of permissions allowed for Principals associated with the enclosed set of classes. Here we always return thePermissionCollectionafter adding theISPermissionobject into it, so that policy determination is also based on OpenAM's policies.- Overrides:
getPermissionsin classPolicy- Parameters:
protectionDomain- the protection domain which encapsulates the characteristics of a domain, which encloses the set of classes whose instances are granted the permissions when being executed on behalf of the given set of Principals.- Returns:
- the Collection of permissions allowed for the protection domain according to the policy.
- Throws:
SecurityException- if the current thread does not have permission to callgetPermissionson the policy object.
-
getPermissions
public PermissionCollection getPermissions(CodeSource codesource)
Evaluates the global policy and returns aPermissionCollectionobject specifying the set of permissions allowed for Principals associated with the specified code source. Here we always return thePermissionCollectionafter adding theISPermissionobject into it, so that policy determination is also based on OpenAM's policies.- Overrides:
getPermissionsin classPolicy- Parameters:
codesource- theCodeSourceassociated with the caller. This encapsulates the original location of the code (where the code came from) and the public key(s) of its signer.This parameter may be null.- Returns:
- the Collection of permissions allowed for the code
from
codesourceaccording to the policy. - Throws:
SecurityException- if the current thread does not have permission to callgetPermissionson the policy object.
-
refresh
public void refresh()
Refreshes/reloads the policy configuration. The behavior of this method depends on the implementation. In this implementation we will call refresh on thedefaultPolicywe saved in theISPolicyconstructor.- Overrides:
refreshin classPolicy- Throws:
SecurityException- if the current thread does not have permission to refresh this Policy object.
-
-