|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.platform.security.api.AuthorizationPolicy
public class AuthorizationPolicy
The AuthorizationPolicy class defines a set of permissions (i.e., permissions) that apply to a set of principals (@see MetaMatrixPrincipalName). Each permission defines a resource (or set of resources) that are to be controlled, what actions are allowed, and possibly any additional restrictions that should be placed upon the resource to limit content (i.e., content modifiers).
Constructor Summary | |
---|---|
AuthorizationPolicy(AuthorizationPolicy orig)
Create an instance of an AuthorizationPolicy from a copy of another. |
|
AuthorizationPolicy(AuthorizationPolicyID id)
Create an instance of an AuthorizationPolicy that has the specified ID. |
|
AuthorizationPolicy(AuthorizationPolicyID id,
java.util.Set principals,
java.util.Set permissions)
Create an instance of an AuthorizationPolicy that has the specified ID, principal set and permissions. |
Method Summary | |
---|---|
boolean |
addAllPermissions(AuthorizationPermissions permissions)
Add to this policy's set of existing permissions a new set of permissions that are to be applied by the policy. |
boolean |
addAllPermissions(java.util.Set permissions)
Add to this policy's set of existing permissions a set of additional permissions that are to be applied by the policy. |
boolean |
addAllPrincipals(java.util.Set newPrincipals)
Add to this policy's set of existing principals a set of new MetaMatrixPrincipalName to whom this policy is to apply. |
boolean |
addPermission(AuthorizationPermission permission)
Add to this policy's set of existing permissions a new permission that is to be applied by the policy. |
boolean |
addPrincipal(MetaMatrixPrincipalName principal)
Add to this policy's set of existing principals a new MetaMatrixPrincipalName name to whom this policy is to apply. |
void |
clearPrincipals()
Remove from this policy the entire set of existing MetaMatrixPrincipalName references. |
int |
compareTo(java.lang.Object o)
Compares this AuthorizationPolicy to another Object. |
boolean |
equals(java.lang.Object obj)
Returns true if the specified object is semantically equal to this instance. |
AuthorizationPermission |
findPermissionWithResource(AuthorizationResource resource)
Given an AuthorizationResource , find the AuthorizationPermission ,
if any, that supplies an AuthorizationAction for that resource. |
AuthorizationPolicyID |
getAuthorizationPolicyID()
Obtain the identifier for this policy. |
java.util.Collection |
getDependantPermissions(AuthorizationResource resource)
Given an AuthorizationResource , find the AuthorizationPermission s,
if any, that are dependant on that resource. |
java.lang.String |
getDescription()
Obtain the description for this policy which may be null. |
int |
getPermissionCount()
Obtain the number of permissions that this policy applies. |
java.util.Set |
getPermissions()
Obtain the permissions that this policy applies as a Set. |
int |
getPrincipalCount()
Obtain the number of principals that this policy applies to. |
java.util.Set |
getPrincipals()
Obtain the set of principal names that this policy applies to. |
int |
hashCode()
Overrides Object hashCode method. |
boolean |
hasPermissions()
Return whether this policy currently has at least one permission instance. |
boolean |
hasPrincipal()
Return whether this policy currently has at least one principal reference. |
boolean |
implies(AuthorizationPermission permission)
Checks to see if any of the AuthorizationPermission instances in this policy imply access to the resouces in the permission object. |
java.util.Iterator |
iterator()
Obtain an iterator over the AuthorizationPermission instances that this policy applies. |
void |
removePermission(AuthorizationPermission permission)
Remove from this policy's set of existing permissions the specified permission. |
void |
removePermissions()
Remove all of this policy's existing permissions. |
void |
removePrincipal(MetaMatrixPrincipalName principal)
Remove from this policy's set of existing principals the specified MetaMatrixPrincipalName . |
void |
setDescription(java.lang.String desc)
Define the set of description for this policy. |
void |
setPermissions(AuthorizationPermissions permissions)
Define the set of permissions that this policy is to apply. |
void |
setPrincipals(java.util.Set principals)
Define the set of MetaMatrixPrincipalName s that this policy applies to. |
java.lang.String |
toString()
Returns a string describing this policy object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AuthorizationPolicy(AuthorizationPolicyID id)
id
- the ID of the policypublic AuthorizationPolicy(AuthorizationPolicyID id, java.util.Set principals, java.util.Set permissions)
id
- the ID of the policyprincipals
- the set of MetaMatrixPrincipalName
s to which this policy applies.permissions
- the permissions that define the resource access for this policy.public AuthorizationPolicy(AuthorizationPolicy orig)
orig
- the original policy that this new instance is to be based uponMethod Detail |
---|
public AuthorizationPermission findPermissionWithResource(AuthorizationResource resource)
AuthorizationResource
, find the AuthorizationPermission
,
if any, that supplies an AuthorizationAction
for that resource.
resource
- The resource for which to find a permission.
public java.util.Collection getDependantPermissions(AuthorizationResource resource)
AuthorizationResource
, find the AuthorizationPermission
s,
if any, that are dependant on that resource. An AuthorizationPermission
is
dependant on a resource if it has any AuthorizationAction
s on that resource
or if it is part of a recursive permission involving the resource.
resource
- The resource for which to find a permission.
public AuthorizationPolicyID getAuthorizationPolicyID()
public java.util.Set getPrincipals()
MetaMatrixPrincipalName
s to which this
policy applies; never null but possibly emptypublic int getPrincipalCount()
public int getPermissionCount()
public java.util.Set getPermissions()
public boolean hasPermissions()
public java.lang.String getDescription()
public java.util.Iterator iterator()
public boolean hasPrincipal()
public boolean implies(AuthorizationPermission permission)
permission
- the AuthorizationPermission object to check.
public java.lang.String toString()
super.toString() ( // the authorization policy ID of the policy ... // the description of the policy ... // enumerate all the Principal // objects and call toString() on them, // one per line.. // enumerate all the AuthorizationPermission // objects and call toString() on them, // one per line.. )
super.toString
is a call to the toString
method of this
object's superclass, which is Object. The result is
this object's type name followed by this object's
hashcode, thus enabling clients to differentiate different
AuthorizationPolicy objects, even if they contain the same permissions.
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
,
Object.equals(Object)
public boolean equals(java.lang.Object obj)
compareTo()
.
equals
in class java.lang.Object
obj
- the object that this instance is to be compared to.
public int compareTo(java.lang.Object o) throws java.lang.ClassCastException
equals()
.
compareTo
in interface java.lang.Comparable
o
- the object that this instance is to be compared to.
java.lang.ClassCastException
- if the specified object's type prevents it
from being compared to this AuthorizationPolicy.public void setDescription(java.lang.String desc)
desc
- the new description for this policy.public void setPermissions(AuthorizationPermissions permissions)
permissions
- the new permissions that this policy applies.public void setPrincipals(java.util.Set principals)
MetaMatrixPrincipalName
s that this policy applies to. Any existing
MetaMatrixPrincipalName
s are removed from the policy. If the specified set is null or empty,
this policy will apply to no principals.
principals
- the new set of MetaMatrixPrincipalName
s to which this policy applies.public boolean addPermission(AuthorizationPermission permission)
permission
- the new permission that is to be added to this policy. May not be null.
java.lang.IllegalArgumentException
- if the specified permission is null.public boolean addAllPermissions(AuthorizationPermissions permissions)
permissions
- the new permissions that are to be added to this policy. May not be null.
java.lang.IllegalArgumentException
- if the specified permission is null.public boolean addAllPermissions(java.util.Set permissions)
permissions
- the set of new permissions that are to be added to this policy. May not be null.
java.lang.IllegalArgumentException
- if the specified set of permissions is null or if the set contains a null value.public void removePermission(AuthorizationPermission permission)
permission
- the permission that is to be removed from this policy.public void removePermissions()
public boolean addPrincipal(MetaMatrixPrincipalName principal)
MetaMatrixPrincipalName
name to whom this policy is to apply.
principal
- the new MetaMatrixPrincipalName
that is to be added to this policy. May not be null.
java.lang.IllegalArgumentException
- if the specified principal is null.public boolean addAllPrincipals(java.util.Set newPrincipals)
MetaMatrixPrincipalName
to whom this policy is to apply.
newPrincipals
- the set of new MetaMatrixPrincipalName
that are to be added to this policy. May not be null.
java.lang.IllegalArgumentException
- if the specified set of principals is null or if the set contains a null value.public void removePrincipal(MetaMatrixPrincipalName principal)
MetaMatrixPrincipalName
.
If the principal is not in the existing set of principal names for this policy,
this method simply does nothing for that principal.
principal
- the MetaMatrixPrincipalName
that is to be removed from this policy.public void clearPrincipals()
MetaMatrixPrincipalName
references.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |