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 JAASPermission
which extends thePermission
class. 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 serviceiPlanetAMWebAgentService
which has aRule
defined for resourcehttp://www.example.com:80
with 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. AlsoISPermission
co-exists with the permissions specified in the JDK policy store ( by default filesun.security.provider.PolicyFile
or 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 anISPermission
instance, with the specified service name, resource name and action name.ISPermission(String serviceName, String resourceName, String actions, Map envParams)
Constructs anISPermission
instance, with the specified service name, resource name and action name.ISPermission(CodeSource codesource)
Constructs anISPermission
instance, with the specifiedCodeSource
.protected
ISPermission(ProtectionDomain pd)
Constructs anISPermission
instance, with the specifiedProtectionDomain
.ISPermission(Subject subject, CodeSource codesource)
Constructs anISPermission
instance, with the specifiedSubject
and theCodeSource
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Returns true if twoISPermission
objects for equality.String
getActions()
returns a comma separated list of actions associated with thisISPermission
.CodeSource
getCodeSource()
returns theCodeSource
associated with thisISPermission
.Map
getEnvParams()
returns environment parameters and their values associated with thisISPermission
.ProtectionDomain
getProtectionDomain()
returns theProtectionDomain
associated with thisISPermission
.String
getResourceName()
returns the name of the resource associated with thisISPermission
.String
getServiceName()
returns the name of the service associated with thisISPermission
.Subject
getSubject()
returns theSubject
associated with thisISPermission
.int
hashCode()
Returns the hash code value for this Permission object.boolean
implies(Permission perm)
Checks if the specified permission's actions are "implied by" this object's actions.PermissionCollection
newPermissionCollection()
Returns ajava.security.PermissionCollection
to store this kind of Permission.String
toString()
Returns a string describing this Permission.-
Methods inherited from class java.security.Permission
checkGuard, getName
-
-
-
-
Constructor Detail
-
ISPermission
protected ISPermission(ProtectionDomain pd)
Constructs anISPermission
instance, with the specifiedProtectionDomain
.- Parameters:
pd
-ProtectionDomain
for which thisISPermission
is being created.
-
ISPermission
public ISPermission(Subject subject, CodeSource codesource)
Constructs anISPermission
instance, with the specifiedSubject
and theCodeSource
.- Parameters:
subject
-Subject
for which thisISPermission
is being created.codesource
-CodeSource
for which this permission is being created.
-
ISPermission
public ISPermission(CodeSource codesource)
Constructs anISPermission
instance, with the specifiedCodeSource
.- Parameters:
codesource
-CodeSource
for which this permission is being created.
-
ISPermission
public ISPermission(String serviceName, String resourceName, String actions)
Constructs anISPermission
instance, with the specified service name, resource name and action name.- Parameters:
serviceName
- name of service for which thisISPermission
is being created. This name needs to be one of the loaded services in the OpenAM's policy engine. example:iPlanetAMWegAgentService
resourceName
- name of the resource for which thisISPermission
is being defined.actions
- name of the action that needs to be checked for. It may be aString
like "GET", "POST" in case of service nameiPlanetAMWebAgentService
.
-
ISPermission
public ISPermission(String serviceName, String resourceName, String actions, Map envParams)
Constructs anISPermission
instance, with the specified service name, resource name and action name.- Parameters:
serviceName
- name of service for which thisISPermission
is being created. This name needs to be one of the loaded policy services in the OpenSSO. example:iPlanetAMWegAgentService
resourceName
- name of the resource for which thisISPermission
is being defined.actions
- name of the action that needs to be checked for. It may be aString
like "GET", "POST" in case of service nameiPlanetAMWebAgentService
.envParams
- ajava.util.Map
of environment parameters which are used by thecom.sun.identity.policy.client.PolicyEvaluator
to evaluate thecom.sun.identity.policy.Conditions
associated 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:
String
representing the name of the service for this permission.
-
getResourceName
public String getResourceName()
returns the name of the resource associated with thisISPermission
.- Returns:
String
representing the name of the resource for this permission.
-
getEnvParams
public Map getEnvParams()
returns environment parameters and their values associated with thisISPermission
.- Returns:
Map
representing the environment parameters of this permission. TheMap
consists of attribute value pairs.
-
getActions
public String getActions()
returns a comma separated list of actions associated with thisISPermission
.- Specified by:
getActions
in classPermission
- Returns:
- a comma separated
String
representing 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 theSubject
associated with thisISPermission
.- Returns:
javax.security.auth.Subject
representing the subject of this permission.
-
getCodeSource
public CodeSource getCodeSource()
returns theCodeSource
associated with thisISPermission
.- Returns:
java.security.CodeSource
representing thecodesource
of this permission.
-
getProtectionDomain
public ProtectionDomain getProtectionDomain()
returns theProtectionDomain
associated with thisISPermission
.- Returns:
java.security.ProtectionDomain
representing theprotectionDomain
of this permission.
-
equals
public boolean equals(Object obj)
Returns true if twoISPermission
objects for equality.- Specified by:
equals
in classPermission
- Parameters:
obj
-ISPermission
object.- 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
hashCode
behavior 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
hashCode
method 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
equals
method, then calling thehashCode
method on each of the two Permission objects must produce the same integer result.
- Specified by:
hashCode
in 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
implies
method is used by theAccessController
to 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:
implies
in 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.PermissionCollection
to store this kind of Permission.- Overrides:
newPermissionCollection
in classPermission
- Returns:
- an instance of
ISPermissionCollection
-
toString
public String toString()
Returns a string describing this Permission.- Overrides:
toString
in classPermission
- Returns:
String
containing information about this Permission.
-
-