Class PolicyConfig

  • All Implemented Interfaces:
    ServiceListener

    public class PolicyConfig
    extends Object
    implements ServiceListener
    The PolicyConfig class manages policy configuration for an organization and resource comparator configuration for a serviceType. The policy organization configuration is defined in amPolicyConfiguration service. The policy configuration values need to be set for each organization. The Subject implementations get these configuration values as a Map. The keys to the map are defined as constants in this class. Different Subject implementations need different key values. For example, LDAP Group subject needs LDAP_GROUP_SEARCH_FILTER, LDAP_GROUP_SEARCH_SCOPE. All subject plugins that do not use Identity repository API, will require LDAP_SERVER, LDAP_BASE_DN, LDAP_BIND_DN, LDAP_BIND_PASSWORD.

    The resource comparator configuration is a Map. The keys to this map are serviceType names. For example, "iplanetAMWebAgentService". The value for these keys is also a Map. The value map contains following keys. This map is passed to the ResourceComparator class while instantiating a ResourceComparator class. The map contains the following keys:

    • RESOURCE_COMPARATOR_CLASS
    • RESOURCE_COMPARATOR_WILDCARD
    • RESOURCE_COMPARATOR_ONE_LEVEL_WILDCARD
    • RESOURCE_COMPARATOR_DELIMITER
    • RESOURCE_COMPARATOR_CASE_SENSITIVE
    • Method Detail

      • getResourceCompareConfig

        public static Map getResourceCompareConfig​(String service)
                                            throws PolicyException
        Returns the resource comparator configuration for the given service type
        Parameters:
        service - ServiceType name
        Returns:
        - Map containing data for RESOURCE_COMPARATOR_CLASS, RESOURCE_COMPARATOR_DELIMITER, RESOURCE_COMPARATOR_WILDCARD, RESOURCE_COMPARATOR_ONE_LEVEL_WILDCARD, RESOURCE_COMPARATOR_CASE_SENSITIVE keys. Note that return value would be null if service name passed in is null or if there is no configuration available for service
        Throws:
        PolicyException
      • getPolicyConfig

        public static Map getPolicyConfig​(String org)
                                   throws PolicyException
        this method returns the policy configuration for the given organization.
        Parameters:
        org - Organization name
        Returns:
        Map of organization configuration attributes. The possible keys in the map are defined in PolicyConfig
        Throws:
        PolicyException - if it is not able to get the policy configuration for the given organization.
      • schemaChanged

        public void schemaChanged​(String serviceName,
                                  String version)
        This method will be invoked when a service's schema has been changed.
        Specified by:
        schemaChanged in interface ServiceListener
        Parameters:
        serviceName - name of the service
        version - version of the service
      • globalConfigChanged

        public void globalConfigChanged​(String serviceName,
                                        String version,
                                        String groupName,
                                        String serviceComponent,
                                        int changeType)
        This method will be invoked when a service's global configuation data has been changed. The parameter groupName denote the name of the configuration grouping (e.g. default) and serviceComponent denotes the service's sub-component that changed
        Specified by:
        globalConfigChanged in interface ServiceListener
        Parameters:
        serviceName - name of the service
        version - version of the service
        serviceComponent - name of the service components that changed
        groupName - name of the configuration grouping.
        changeType - change type, i.e., ADDED, REMOVED or MODIFIED.
      • organizationConfigChanged

        public void organizationConfigChanged​(String serviceName,
                                              String version,
                                              String orgName,
                                              String groupName,
                                              String serviceComponent,
                                              int changeType)
        This method will be invoked when a service's organization configuation data has been changed. The parameters orgName, groupName and serviceComponent denotes the organization name, configuration grouping name and service's sub-component that are changed respectively.
        Specified by:
        organizationConfigChanged in interface ServiceListener
        Parameters:
        serviceName - name of the service
        version - version of the service
        groupName - the configuration grouping name that changed
        orgName - organization name as DN
        serviceComponent - the name of the service components that changed
        changeType - change type, i.e., ADDED, REMOVED or MODIFIED
      • getSubjectsResultTtl

        public static long getSubjectsResultTtl​(Map policyConfig)
        Gets subjectsResultTtl - time in milliseconds for which result of subjects evaluation would be cached based, on the policyConfig map passed.
        Parameters:
        policyConfig - policy config map that is used to compute subjectsResultTtl. Value of key PolicyConfig.SUBJECTS_RESULT_TTL in the map is assumed to be value of subjectsResultTtl in minutes. If the value is not defined in the map or it can not be parsed as int, the value would default to 0
        Returns:
        subjectsResultTtl
      • getAdvicesHandleableByAM

        public static Set getAdvicesHandleableByAM()
                                            throws PolicyException
        Returns names of policy advices that could be handled by OpenSSO Enterprise if PEP redirects the user agent to OpenSSO.
        Returns:
        Set representing names of policy advices OpenSSO could handle.
        Throws:
        PolicyException