Package com.sun.identity.policy.jaas
Class ISPermission
- java.lang.Object
-
- java.security.Permission
-
- com.sun.identity.policy.jaas.ISPermission
-
- All Implemented Interfaces:
Serializable,Guard
public class ISPermission extends Permission
This class provides the support for JAAS Authorization service Its a new JAASPermissionwhich extends thePermissionclass. This is the only API which gets used by an application/container to evaluate policy against the OpenAM Policy framework. This class provides implementations of all the required abstract methods ofjava.security.Permission, in a way that the policy evaluation is made against the OpenAM Policy service.For example, one would use this class as follows to evaluate policy permissions:
ISPermission perm = new ISPermission("iPlanetAMWebAgentService", "http://www.example.com:80","GET"); AccessController.checkPermission(perm);If OpenAM has the policy serviceiPlanetAMWebAgentServicewhich has aRuledefined for resourcehttp://www.example.com:80with action "GET" with allow privilege, this call will return quietly, if such a policy is not found then access is denied and Exception thrown accordingly. AlsoISPermissionco-exists with the permissions specified in the JDK policy store ( by default filesun.security.provider.PolicyFileor defined on the command line using the -D option.- See Also:
Permission,Subject,ProtectionDomain, Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description ISPermission(String serviceName, String resourceName, String actions)Constructs anISPermissioninstance, with the specified service name, resource name and action name.ISPermission(String serviceName, String resourceName, String actions, Map envParams)Constructs anISPermissioninstance, with the specified service name, resource name and action name.ISPermission(CodeSource codesource)Constructs anISPermissioninstance, with the specifiedCodeSource.protectedISPermission(ProtectionDomain pd)Constructs anISPermissioninstance, with the specifiedProtectionDomain.ISPermission(Subject subject, CodeSource codesource)Constructs anISPermissioninstance, with the specifiedSubjectand theCodeSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Returns true if twoISPermissionobjects for equality.StringgetActions()returns a comma separated list of actions associated with thisISPermission.CodeSourcegetCodeSource()returns theCodeSourceassociated with thisISPermission.MapgetEnvParams()returns environment parameters and their values associated with thisISPermission.ProtectionDomaingetProtectionDomain()returns theProtectionDomainassociated with thisISPermission.StringgetResourceName()returns the name of the resource associated with thisISPermission.StringgetServiceName()returns the name of the service associated with thisISPermission.SubjectgetSubject()returns theSubjectassociated with thisISPermission.inthashCode()Returns the hash code value for this Permission object.booleanimplies(Permission perm)Checks if the specified permission's actions are "implied by" this object's actions.PermissionCollectionnewPermissionCollection()Returns ajava.security.PermissionCollectionto store this kind of Permission.StringtoString()Returns a string describing this Permission.-
Methods inherited from class java.security.Permission
checkGuard, getName
-
-
-
-
Constructor Detail
-
ISPermission
protected ISPermission(ProtectionDomain pd)
Constructs anISPermissioninstance, with the specifiedProtectionDomain.- Parameters:
pd-ProtectionDomainfor which thisISPermissionis being created.
-
ISPermission
public ISPermission(Subject subject, CodeSource codesource)
Constructs anISPermissioninstance, with the specifiedSubjectand theCodeSource.- Parameters:
subject-Subjectfor which thisISPermissionis being created.codesource-CodeSourcefor which this permission is being created.
-
ISPermission
public ISPermission(CodeSource codesource)
Constructs anISPermissioninstance, with the specifiedCodeSource.- Parameters:
codesource-CodeSourcefor which this permission is being created.
-
ISPermission
public ISPermission(String serviceName, String resourceName, String actions)
Constructs anISPermissioninstance, with the specified service name, resource name and action name.- Parameters:
serviceName- name of service for which thisISPermissionis being created. This name needs to be one of the loaded services in the OpenAM's policy engine. example:iPlanetAMWegAgentServiceresourceName- name of the resource for which thisISPermissionis being defined.actions- name of the action that needs to be checked for. It may be aStringlike "GET", "POST" in case of service nameiPlanetAMWebAgentService.
-
ISPermission
public ISPermission(String serviceName, String resourceName, String actions, Map envParams)
Constructs anISPermissioninstance, with the specified service name, resource name and action name.- Parameters:
serviceName- name of service for which thisISPermissionis being created. This name needs to be one of the loaded policy services in the OpenSSO. example:iPlanetAMWegAgentServiceresourceName- name of the resource for which thisISPermissionis being defined.actions- name of the action that needs to be checked for. It may be aStringlike "GET", "POST" in case of service nameiPlanetAMWebAgentService.envParams- ajava.util.Mapof environment parameters which are used by thecom.sun.identity.policy.client.PolicyEvaluatorto evaluate thecom.sun.identity.policy.Conditionsassociated with the policy. This is a Map of attribute-value pairs representing the environment under which the policy needs to be evaluated.
-
-
Method Detail
-
getServiceName
public String getServiceName()
returns the name of the service associated with thisISPermission.- Returns:
Stringrepresenting the name of the service for this permission.
-
getResourceName
public String getResourceName()
returns the name of the resource associated with thisISPermission.- Returns:
Stringrepresenting the name of the resource for this permission.
-
getEnvParams
public Map getEnvParams()
returns environment parameters and their values associated with thisISPermission.- Returns:
Maprepresenting the environment parameters of this permission. TheMapconsists of attribute value pairs.
-
getActions
public String getActions()
returns a comma separated list of actions associated with thisISPermission.- Specified by:
getActionsin classPermission- Returns:
- a comma separated
Stringrepresenting the name of the action for this object. For example for:ISPermission isp = new ISPermission("iPlanetAMWebAgentService, "http://www.sun.com:80", "GET, POST"); getActions() would return "GET,POST"
-
getSubject
public Subject getSubject()
returns theSubjectassociated with thisISPermission.- Returns:
javax.security.auth.Subjectrepresenting the subject of this permission.
-
getCodeSource
public CodeSource getCodeSource()
returns theCodeSourceassociated with thisISPermission.- Returns:
java.security.CodeSourcerepresenting thecodesourceof this permission.
-
getProtectionDomain
public ProtectionDomain getProtectionDomain()
returns theProtectionDomainassociated with thisISPermission.- Returns:
java.security.ProtectionDomainrepresenting theprotectionDomainof this permission.
-
equals
public boolean equals(Object obj)
Returns true if twoISPermissionobjects for equality.- Specified by:
equalsin classPermission- Parameters:
obj-ISPermissionobject.- Returns:
- true if subject,
codesource, service name, resource name actions and environment parameters of both objects are equal.
-
hashCode
public int hashCode()
Returns the hash code value for this Permission object.The required
hashCodebehavior for Permission Objects is the following:- Whenever it is invoked on the same Permission object more than
once during an execution of a Java application, the
hashCodemethod must consistently return the same integer. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two Permission objects are equal according to the
equalsmethod, then calling thehashCodemethod on each of the two Permission objects must produce the same integer result.
- Specified by:
hashCodein classPermission- Returns:
- a hash code value for this object.
- Whenever it is invoked on the same Permission object more than
once during an execution of a Java application, the
-
implies
public boolean implies(Permission perm)
Checks if the specified permission's actions are "implied by" this object's actions.The
impliesmethod is used by theAccessControllerto determine whether or not a requested permission is implied by another permission that is known to be valid in the current execution context.- Specified by:
impliesin classPermission- Parameters:
perm- the permission to check against.- Returns:
- true if the specified permission is implied by this object, false if not. The check is made against the OpenAM's policy service to determine this evaluation.
-
newPermissionCollection
public PermissionCollection newPermissionCollection()
Returns ajava.security.PermissionCollectionto store this kind of Permission.- Overrides:
newPermissionCollectionin classPermission- Returns:
- an instance of
ISPermissionCollection
-
toString
public String toString()
Returns a string describing this Permission.- Overrides:
toStringin classPermission- Returns:
Stringcontaining information about this Permission.
-
-