Package com.sun.identity.policy.plugins
Class IDRepoResponseProvider
- java.lang.Object
-
- com.sun.identity.policy.plugins.IDRepoResponseProvider
-
- All Implemented Interfaces:
ResponseProvider,Cloneable
public class IDRepoResponseProvider extends Object implements ResponseProvider
This class is an out of the box implementation ofResponseProviderinterface. It defines 2 types of user attributes which it can fetch the values of:STATICandDYNAMIC. It relies on underlying Identity repository service to fetch the attribute values for the Subject(s) defined in the policy. It computes aMapof response attributes based on the sso token, resource name andenvmap passed in the method callgetResponseDecision(). Policy framework would make a call to the ResponseProvider to fetch response attributes in a policy only if the policy is applicable to a request as determined by sso token, resource name, Subjects and Conditions.
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_DELIMITERstatic StringDYNAMIC_ATTRIBUTEstatic StringSTATIC_ATTRIBUTEstatic StringVAL_DELIMITER
-
Constructor Summary
Constructors Constructor Description IDRepoResponseProvider()No argument constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Returns a copy of this object.StringgetDisplayName(String property, Locale locale)Gets the display name for the property name.MapgetProperties()Gets the properties of the responseproviderListgetPropertyNames()Returns a list of property names for the responseprovider.SyntaxgetPropertySyntax(String property)Returns the syntax for a property nameMapgetResponseDecision(SSOToken token, Map env)Gets the response attributes computed by this ResponseProvider object, based on the sso token and map of environment parametersSetgetValidValues(String property)Returns a set of valid values given the property name.voidinitialize(Map configParams)Initialize the IDRepoResponseProvider object by using the configuration information passed by the Policy Framework.voidsetProperties(Map properties)Sets the properties of the responseProvider plugin.
-
-
-
Field Detail
-
STATIC_ATTRIBUTE
public static final String STATIC_ATTRIBUTE
- See Also:
- Constant Field Values
-
DYNAMIC_ATTRIBUTE
public static final String DYNAMIC_ATTRIBUTE
- See Also:
- Constant Field Values
-
ATTR_DELIMITER
public static final String ATTR_DELIMITER
- See Also:
- Constant Field Values
-
VAL_DELIMITER
public static final String VAL_DELIMITER
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(Map configParams) throws PolicyException
Initialize the IDRepoResponseProvider object by using the configuration information passed by the Policy Framework.- Specified by:
initializein interfaceResponseProvider- Parameters:
configParams- the configuration information- Throws:
PolicyException- if an error occured during initialization of the instance
-
getPropertyNames
public List getPropertyNames()
Returns a list of property names for the responseprovider.- Specified by:
getPropertyNamesin interfaceResponseProvider- Returns:
Listof property names
-
getPropertySyntax
public Syntax getPropertySyntax(String property)
Returns the syntax for a property name- Specified by:
getPropertySyntaxin interfaceResponseProvider- Parameters:
property- property name- Returns:
Syntaxfor the property name- See Also:
Syntax
-
getDisplayName
public String getDisplayName(String property, Locale locale) throws PolicyException
Gets the display name for the property name. Thelocalevariable could be used by the plugin to customize the display name for the given locale. Thelocalevariable could benull, in which case the plugin must use the default locale.- Specified by:
getDisplayNamein interfaceResponseProvider- Parameters:
property- property namelocale- locale for which the property name must be customized- Returns:
- display name for the property name.
- Throws:
PolicyException
-
getValidValues
public Set getValidValues(String property) throws PolicyException
Returns a set of valid values given the property name. This method is called if the property Syntax is either the SINGLE_CHOICE or MULTIPLE_CHOICE.- Specified by:
getValidValuesin interfaceResponseProvider- Parameters:
property- property name from the PolicyConfig Service configured for the specified realm.- Returns:
- Set of valid values for the property.
- Throws:
PolicyException- if unable to get the Syntax.
-
setProperties
public void setProperties(Map properties) throws PolicyException
Sets the properties of the responseProvider plugin. This influences the response attribute-value Map that would be computed by a call to methodgetResponseDecision(Map)These attribute-value pairs are encapsulated inResponseAttributeelement tag which is a child of thePolicyDecisionelement in the PolicyResponse xml if the policy is applicable to the user for the resource, subject and conditions defined.- Specified by:
setPropertiesin interfaceResponseProvider- Parameters:
properties- the properties of the responseProvider Keys of the properties have to be String. Value corresponding to each key have to be a Set of String elements. Each implementation of ResponseProvider could add further restrictions on the keys and values of this map.- Throws:
PolicyException- for any abnormal condition
-
getProperties
public Map getProperties()
Gets the properties of the responseprovider- Specified by:
getPropertiesin interfaceResponseProvider- Returns:
- properties of the responseprovider
- See Also:
setProperties(java.util.Map)
-
getResponseDecision
public Map getResponseDecision(SSOToken token, Map env) throws PolicyException, SSOException
Gets the response attributes computed by this ResponseProvider object, based on the sso token and map of environment parameters- Specified by:
getResponseDecisionin interfaceResponseProvider- Parameters:
token- single-sign-on token of the userenv- specific environment map of key/value pairs- Returns:
- a Map of response attributes. Keys of the Map are attribute names STATIC_ATTRIBUTE or DYNAMIC_ATTRIBUTE. Value is a Set of Strings representing response attribute values.
- Throws:
PolicyException- if the decision could not be computedSSOException- if SSO token is not valid
-
clone
public Object clone()
Returns a copy of this object.- Specified by:
clonein interfaceResponseProvider- Overrides:
clonein classObject- Returns:
- a copy of this object
-
-