© 2005 BEA Systems, Inc.

com.bea.p13n.entitlements.management
Class SecurityPolicyManager

java.lang.Object
  extended bycom.bea.p13n.entitlements.management.SecurityPolicyManager

public class SecurityPolicyManager
extends Object

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


Constructor Summary
SecurityPolicyManager()
           
 
Method Summary
static void createSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
          Creates a new security policy.
static SecurityPolicyItem getSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
          Retrieves an existing security policy.
static Object[][] listPoliciesForResource(P13nResource aSecurityResource)
          Finds all available security policies given a policy item (resourceId).
static Object[][] listPoliciesForResource(SecurityPolicyItem aSecurityPolicyItem)
          Finds all available security policies given a policy item (resourceId).
static boolean policyExists(SecurityPolicyItem aSecurityPolicyItem)
          Checks if a security policy exists for a given resource
static void removeAllSecurityPolicies(String anEntAppName, String aWebAppName, P13nContextHandler aContextHandler)
          Removes all existing security policies and role policies for a given web application.
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.
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.
static void removeSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
          Removes an existing security policy.
static void setSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
          Updates an existing security policy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityPolicyManager

public SecurityPolicyManager()
Method Detail

createSecurityPolicy

public static void createSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
                                 throws com.bea.p13n.entitlements.common.PolicyExistsException,
                                        com.bea.p13n.entitlements.common.PolicyCreateException
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
Throws:
com.bea.p13n.entitlements.common.InvalidArgsException
com.bea.p13n.entitlements.common.PolicyExistsException
com.bea.p13n.entitlements.common.PolicyCreateException

getSecurityPolicy

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
Throws:
com.bea.p13n.entitlements.common.InvalidArgsException

listPoliciesForResource

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.

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

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.

policyExists

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

public static void removeAllSecurityPolicies(String anEntAppName,
                                             String aWebAppName,
                                             P13nContextHandler aContextHandler)
                                      throws com.bea.p13n.entitlements.common.EntitlementsException
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
Throws:
com.bea.p13n.entitlements.common.EntitlementsException

removeAllSecurityPolicies

public static void removeAllSecurityPolicies(String anEntAppName,
                                             String aWebAppName,
                                             String aRoleName,
                                             int aPolicyUser,
                                             P13nContextHandler aContextHandler)
                                      throws com.bea.p13n.entitlements.common.EntitlementsException
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 - If non-null, only removes policies predicated on the given role
Throws:
com.bea.p13n.entitlements.common.EntitlementsException

removePoliciesOnResourceSubString

public static void removePoliciesOnResourceSubString(String aResourceIdSubString,
                                                     String aWebAppName,
                                                     boolean onResourceIdRoot,
                                                     int thePolicyUser,
                                                     P13nContextHandler aP13nContextHandler)
                                              throws com.bea.p13n.entitlements.common.EntitlementsException
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
aP13nContextHandler - 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
Throws:
com.bea.p13n.entitlements.common.EntitlementsException

removeSecurityPolicy

public static void removeSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
                                 throws com.bea.p13n.entitlements.common.PolicyNotFoundException,
                                        com.bea.p13n.entitlements.common.PolicyRemoveException
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
Throws:
com.bea.p13n.entitlements.common.InvalidArgsException
com.bea.p13n.entitlements.common.PolicyNotFoundException
com.bea.p13n.entitlements.common.PolicyRemoveException

setSecurityPolicy

public static void setSecurityPolicy(SecurityPolicyItem aSecurityPolicyItem)
                              throws com.bea.p13n.entitlements.common.PolicyNotFoundException,
                                     com.bea.p13n.entitlements.common.PolicyCreateException
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
Throws:
com.bea.p13n.entitlements.common.InvalidArgsException
com.bea.p13n.entitlements.common.PolicyNotFoundException
com.bea.p13n.entitlements.common.PolicyCreateException

© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved