Package com.sun.identity.entitlement
Class EntitlementCombiner
- java.lang.Object
-
- com.sun.identity.entitlement.EntitlementCombiner
-
- Direct Known Subclasses:
DenyOverride
public abstract class EntitlementCombiner extends Object
Encapsulates a Strategy for combining the results of twoEntitlements. Across the system, these can also be referred to as "decision combiners"; for example, the set of registered EntitlementCombiners can be retrieved from the/json/decisioncombinersREST endpoint. This is the base class and is, for example, extended byDenyOverride.initneeds to be called after it is created.
-
-
Constructor Summary
Constructors Constructor Description EntitlementCombiner()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(List<Entitlement> entitlements)Adds a set of entitlements to the overall entitlement decision.protected abstract booleancombine(Boolean b1, Boolean b2)Returns the result of combining two entitlement decisions.protected Set<String>getActions()Returns action names.StringgetName()Returns the name of this class for ease of reference.protected ResourceNamegetResourceComparator()Returns the resource comparator.List<Entitlement>getResults()Returns entitlements which are the result of combining a set of entitlements.protected EntitlementgetRootE()Returns the entitlement which will act as the root for sub tree evaluations.voidinit(String realm, String applicationName, String normalisedResourceName, String requestedResourceName, Set<String> actions, boolean isRecursive)Initializes the combiner.voidinit(String normalisedResourceName, String requestedResourceName, Set<String> actions, boolean isRecursive, Application application)Initializes the combiner.protected abstract booleanisCompleted()Returnstrueif policy decision can also be determined.booleanisDone()Returnstrueif policy decision can also be determined.protected booleanisRecursive()Returnstrueif this entitlement combiner is working on sub tree evaluation.protected voidmergeActionValues(Entitlement e1, Entitlement e2)Sets the action values of the first entitlement to be the union of all action values from the first and second entitlements; if a particular action value is contained in both entitlements, then the two values are combined (using the implementation-dependent)combine(java.lang.Boolean, java.lang.Boolean)method) before being added to the first entitlement.protected voidmergeAdvices(Entitlement e1, Entitlement e2)Sets the advices of the first entitlement to be the union of all advices from the first and second entitlements.protected voidmergeAttributes(Entitlement e1, Entitlement e2)Sets the attributes of the first entitlement to be the union of all attributes from the first and second entitlements.protected voidmergeTimeToLiveValue(Entitlement e1, Entitlement e2)Merges time to live values.
-
-
-
Method Detail
-
init
public void init(String realm, String applicationName, String normalisedResourceName, String requestedResourceName, Set<String> actions, boolean isRecursive) throws EntitlementException
Initializes the combiner.- Parameters:
realm- Realm name.applicationName- Application Name.normalisedResourceName- The normalised resource name.requestedResourceName- The requested resource name.actions- Action names to be evaluated.isRecursive-true<for subtree evaluation.- Throws:
EntitlementException
-
init
public void init(String normalisedResourceName, String requestedResourceName, Set<String> actions, boolean isRecursive, Application application) throws EntitlementException
Initializes the combiner.- Parameters:
normalisedResourceName- The normalised resource name.requestedResourceName- The requested resource name.actions- Action names to be evaluated.isRecursive-true<for subtree evaluation.application- The defining application.- Throws:
EntitlementException
-
add
public void add(List<Entitlement> entitlements)
Adds a set of entitlements to the overall entitlement decision. These entitlements will be combined with existing decision.- Parameters:
entitlements- Set of entitlements.
-
mergeActionValues
protected void mergeActionValues(Entitlement e1, Entitlement e2)
Sets the action values of the first entitlement to be the union of all action values from the first and second entitlements; if a particular action value is contained in both entitlements, then the two values are combined (using the implementation-dependent)combine(java.lang.Boolean, java.lang.Boolean)method) before being added to the first entitlement.- Parameters:
e1- Entitlement.e2- Entitlement.
-
mergeAdvices
protected void mergeAdvices(Entitlement e1, Entitlement e2)
Sets the advices of the first entitlement to be the union of all advices from the first and second entitlements.- Parameters:
e1- Entitlement.e2- Entitlement.
-
mergeAttributes
protected void mergeAttributes(Entitlement e1, Entitlement e2)
Sets the attributes of the first entitlement to be the union of all attributes from the first and second entitlements.- Parameters:
e1- Entitlemente2- Entitlement
-
mergeTimeToLiveValue
protected void mergeTimeToLiveValue(Entitlement e1, Entitlement e2)
Merges time to live values. The lowest of the TTL values is set as the TTL.- Parameters:
e1- Entitlemente2- Entitlement
-
isRecursive
protected boolean isRecursive()
Returnstrueif this entitlement combiner is working on sub tree evaluation.- Returns:
trueif this entitlement combiner is working on sub tree evaluation.
-
getRootE
protected Entitlement getRootE()
Returns the entitlement which will act as the root for sub tree evaluations.- Returns:
- root entitlement for sub tree evaluations.
-
getResourceComparator
protected ResourceName getResourceComparator()
Returns the resource comparator.- Returns:
- resource comparator.
-
isDone
public boolean isDone()
Returnstrueif policy decision can also be determined.- Returns:
trueif policy decision can also be determined.
-
getResults
public List<Entitlement> getResults()
Returns entitlements which are the result of combining a set of entitlements.- Returns:
- entitlement results.
-
combine
protected abstract boolean combine(Boolean b1, Boolean b2)
Returns the result of combining two entitlement decisions.- Parameters:
b1- entitlement decision.b2- entitlement decision.- Returns:
- result of combining two entitlement decisions.
-
isCompleted
protected abstract boolean isCompleted()
Returnstrueif policy decision can also be determined. This method is called by derived classes. #isDone method shall be set if this returns true.- Returns:
trueif policy decision can also be determined.
-
getName
public String getName()
Returns the name of this class for ease of reference.- Returns:
- The simple name of this instance's class
-
-