SecurityPolicyManager Class

com.bea.p13n.entitlements.management
SecurityPolicyManager Class

public class SecurityPolicyManager

    extends Object

Provides access to methods for performing security policy management including create, read, modify, and delete actions.


Hierarchy
Object
  SecurityPolicyManager

Constructor Summary

SecurityPolicyManager()

 

Method Summary

public static void
createSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
Creates a new security policy.
public static SecurityPolicyItem
getSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
Retrieves an existing security policy.
public static Object[][]
listPoliciesForResource(SecurityPolicyItem aSecurityPolicyItem)
Finds all available security policies given a policy item (resourceId).
public static Object[][]
listPoliciesForResource(P13nResource aSecurityResource)
Finds all available security policies given a policy item (resourceId).
public static boolean
policyExists(SecurityPolicyItem aSecurityPolicyItem)
Checks if a security policy exists for a given resource
public static void
removeAllSecurityPolicies(String anEntAppName, String aWebAppName, P13nContextHandler aContextHandler)
Removes all existing security policies and role policies for a given web application.
public static void
removeAllSecurityPolicies(String anEntAppName, String aWebAppName, String aRoleName, int aPolicyUser, P13nContextHandler aContextHandler)
Removes all existing security policies and the role policy for a given entapp, web application.
public static void
removePoliciesOnResourceSubString(String aResourceIdSubString, String aWebAppName, boolean onResourceIdRoot, int thePolicyUser, P13nContextHandler aP13nContextHandler)
Removes a list of security policies in which the resource id begins with the input resource string.
public static void
removeSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
Removes an existing security policy.
public static void
setSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
Updates an existing security policy.
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   

Constructor Detail

SecurityPolicyManager

public SecurityPolicyManager()
 

Method Detail

createSecurityPolicy(SecurityPolicyItem) Method

public static void createSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
Creates a new security policy. A security policy may be predicated on one or more user ids, user group names, and/or role names. Prior to trying to persist a new security policy, this method will check the SecurityPolicyItem to insure all mandatory fields have been initialized. Mandatory fields are: 1) anEntAppName, aWebAppName, aResourceId, 2) (at least one of) aUserList, aGroupList, aRoleList.

Parameters

aSecurityPolicyItem
The object containing the required and optional security policy attributes

getSecurityPolicy(SecurityPolicyItem) Method

public static SecurityPolicyItem getSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
Retrieves an existing security policy. Prior to trying to retrieve the security policy, this method will check the SecurityPolicyItem to insure all mandatory fields have been initialized. Mandatory fields are: anEntAppName, aWebAppName, aResourceId.

The returned SecurityPolicyItem may be used to hold local updates to user list, group list, and role list changes prior to persisting the changes using the setSecurityPolicy() method.

Parameters

aSecurityPolicyItem
The object containing the required and optional security policy attributes

Returns

SecurityPolicyItem or exception if unsuccessful

listPoliciesForResource(SecurityPolicyItem) Method

public static Object[][] listPoliciesForResource(SecurityPolicyItem aSecurityPolicyItem)
Finds all available security policies given a policy item (resourceId). Instead of just returning security policies associated at the resource Id (leaf) node, this method may be used to get a full list of security policies associated with the resource taxonomy.

Parameters

aSecurityPolicyItem
The object containing the required and optional security policy attributes

Returns

An 2D array of all the security policies that have been persisted against the given resource id and those also inherited by the resource given its taxonomy. The zero'th element [i][0] contains the P13nResource where the SecurityPolicyItem (elements [i][1..n]) were found.

listPoliciesForResource(P13nResource) Method

public static Object[][] listPoliciesForResource(P13nResource aSecurityResource)
Finds all available security policies given a policy item (resourceId). Instead of just returning security policies associated at the resource Id (leaf) node, this method may be used to get a full list of security policies associated with the resource taxonomy.

Parameters

aSecurityResource
The object containing the required and optional security policy attributes

Returns

An 2D array of all the security policies that have been persisted against the given resource id and those also inherited by the resource given its taxonomy. The zero'th element [i][0] contains the P13nResource where the SecurityPolicyItem (elements [i][1..n]) were found.

policyExists(SecurityPolicyItem) Method

public static boolean policyExists(SecurityPolicyItem aSecurityPolicyItem)
Checks if a security policy exists for a given resource

Parameters

aSecurityPolicyItem
The object containing the required

Returns

True if policy exists, otherwise false

removeAllSecurityPolicies(String, String, P13nContextHandler) Method

public static void removeAllSecurityPolicies(String anEntAppName, 
                                             String aWebAppName, 
                                             P13nContextHandler aContextHandler)
Removes all existing security policies and role policies for a given web application. Prior to trying to remove the security policies, this method will check the SecurityPolicyItem to insure all mandatory fields have been initialized. Mandatory fields are: anEntAppName, aWebAppName, aResourceId.

Parameters

anEntAppName
Enterprise Application name
aWebAppName
Webapp name. Unused for Global role inheritance

removeAllSecurityPolicies(String, String, String, int, P13nContextHandler) Method

public static void removeAllSecurityPolicies(String anEntAppName, 
                                             String aWebAppName, 
                                             String aRoleName, 
                                             int aPolicyUser, 
                                             P13nContextHandler aContextHandler)
Removes all existing security policies and the role policy for a given entapp, web application. Note that any security policy predicated on additional roles (beside aRoleName) will removed using this method.

Parameters

anEntAppName
Enterprise Application name
aWebAppName
Webapp name. Unused for Global role inheritance
aRoleName
entitlementConstants.P13N_ADMIN_POLICY/P13N_VISITOR_POLICY
aPolicyUser
If non-null, only removes policies predicated on the given role

removePoliciesOnResourceSubString(String, String, boolean, int, P13nContextHandler) Method

public static void removePoliciesOnResourceSubString(String aResourceIdSubString, 
                                                     String aWebAppName, 
                                                     boolean onResourceIdRoot, 
                                                     int thePolicyUser, 
                                                     P13nContextHandler aP13nContextHandler)
Removes a list of security policies in which the resource id begins with the input resource string.

Parameters

aResourceIdSubString
The root substring to look for. This string must be delimited according to EntitlementConstants.RESOURCE_ID_DELIMITER
aWebAppName
The context describing the current user
onResourceIdRoot
If true, a match must be on beginning of resource id only
thePolicyUser
entitlementConstants.P13N_ADMIN_POLICY/P13N_VISITOR_POLICY

Returns

List of SecurityPolicyItem's or null if no security policies are found

removeSecurityPolicy(SecurityPolicyItem) Method

public static void removeSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
Removes an existing security policy. Prior to trying to remove the security policy, this method will check the SecurityPolicyItem to insure all mandatory fields have been initialized. Mandatory fields are: anEntAppName, aWebAppName, aResourceId.

Parameters

aSecurityPolicyItem
The object containing the required security policy attributes

setSecurityPolicy(SecurityPolicyItem) Method

public static void setSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
Updates an existing security policy. Prior to trying to update the security policy, this method will check the SecurityPolicyItem to insure all mandatory fields have been initialized. Mandatory fields are: 1) anEntAppName, aWebAppName, aResourceId, 2) (at least one of) aUserList, aGroupList, aRoleList.

Note that if the aSecurityPolicyItem instance was retrieved using getSecurityPolicy(), all mandatory fields will already be initialized. The only fields that are updateable in the persisted security policy are the aUserList, aGroupList, and aRoleList.

Parameters

aSecurityPolicyItem
The object containing the required and optional security policy attributes