Class PolicyResponseProvider

  • All Implemented Interfaces:
    ResourceAttribute

    public class PolicyResponseProvider
    extends Object
    implements ResourceAttribute
    This class is used to wrap legacy response providers from previous OpenAM versions and makes them available to the OpenAM entitlement framework. Note that this class is only used for custom Response Provider implementations.
    Author:
    Steve Ferris
    • Constructor Detail

      • PolicyResponseProvider

        public PolicyResponseProvider()
        Default constructor
      • PolicyResponseProvider

        public PolicyResponseProvider​(String pResponseProviderName,
                                      String className,
                                      String propertyName,
                                      Set<String> propertyValues)
        Used by the entitlement framework to create an instance of this class
        Parameters:
        pResponseProviderName - The name of the instance of the rp
        className - The underlying (custom) policy
        propertyName - The name of the property for this wrapper
        propertyValues - The set of values for this wrapper
    • Method Detail

      • getClassName

        public String getClassName()
        Returns the name of the underlying response provider implementation
        Returns:
        The class name
      • setPropertyName

        public void setPropertyName​(String name)
        Set the name of the property associated with this wrapper
        Specified by:
        setPropertyName in interface ResourceAttribute
        Parameters:
        name - The property name
      • getPropertyName

        public String getPropertyName()
        Get the name of the property associated with this wrapper.
        Specified by:
        getPropertyName in interface ResourceAttribute
        Returns:
        The property name
      • setPropertyValues

        public void setPropertyValues​(Set<String> propertyValues)
        Sets the property values associated with this wrapper
        Parameters:
        propertyValues - The property values
      • evaluate

        public Map<String,​Set<String>> evaluate​(Subject adminSubject,
                                                      String realm,
                                                      Subject subject,
                                                      String resourceName,
                                                      Map<String,​Set<String>> environment)
                                               throws EntitlementException
        Called by the entitlements framework to fetch its resource attributes; cascades the call through to the configured response provider implementation
        Specified by:
        evaluate in interface ResourceAttribute
        Parameters:
        adminSubject - The admin user executing the policy eval
        realm - The realm of the policy eval
        subject - The user who is subject to the policy eval
        resourceName - The resource name of the policy eval
        environment - environment map from the policy eval client
        Returns:
        The attributes (only one since resource attributes are singled)
        Throws:
        EntitlementException
      • getResponseProvider

        public ResponseProvider getResponseProvider()
                                             throws EntitlementException
        Constructs a legacy response provider based on the information in this adapter.
        Returns:
        the legacy response provider
        Throws:
        EntitlementException - if an error occurs constructing the response provider.
      • setPResponseProviderName

        public void setPResponseProviderName​(String pResponseProviderName)
        Sets the name of the response provider within the policy
        Specified by:
        setPResponseProviderName in interface ResourceAttribute
        Parameters:
        pResponseProviderName - The provider name
      • getState

        public String getState()
        Returns the state of the wrapper in a JSON representation
        Specified by:
        getState in interface ResourceAttribute
        Returns:
        the state in JSON format
      • setState

        public void setState​(String state)
        Given a JSON state representation, updates the class appropriately
        Specified by:
        setState in interface ResourceAttribute
        Parameters:
        state -