public abstract class AbstractPolicy extends Object implements PolicyTreeElement
Modifier and Type | Field and Description |
---|---|
protected PolicyMetaData |
metaData |
Modifier | Constructor and Description |
---|---|
protected |
AbstractPolicy()
Constructor used by
PolicyReference , which supplies its own values for the
methods in this class. |
protected |
AbstractPolicy(Node root,
String policyPrefix,
String combiningName)
Constructor used by child classes to initialize the shared data from a DOM root node.
|
protected |
AbstractPolicy(URI id,
String version,
CombiningAlgorithm combiningAlg,
String description,
AbstractTarget target)
Constructor used to create a policy from concrete components.
|
protected |
AbstractPolicy(URI id,
String version,
CombiningAlgorithm combiningAlg,
String description,
AbstractTarget target,
String defaultVersion)
Constructor used to create a policy from concrete components.
|
protected |
AbstractPolicy(URI id,
String version,
CombiningAlgorithm combiningAlg,
String description,
AbstractTarget target,
String defaultVersion,
Set<AbstractObligation> obligationExpressions,
Set<AdviceExpression> adviceExpressions,
List<CombinerParameter> parameters)
Constructor used to create a policy from concrete components.
|
Modifier and Type | Method and Description |
---|---|
protected void |
encodeCommonElements(StringBuilder builder)
Encodes this
Obligation into its XML form and writes this out to the provided
StringBuilder |
AbstractResult |
evaluate(EvaluationCtx context)
Tries to evaluate the policy by calling the combining algorithm on the given policies or
rules.
|
String |
getActionPolicyValue() |
Set |
getAdviceExpressions()
Returns the Set of advice expressions for this policy, which may be empty
|
List<CombinerElement> |
getChildElements()
Returns the
List of CombinerElement s that is provided to the
combining algorithm. |
List<PolicyTreeElement> |
getChildren()
Returns the
List of children under this node in the policy tree. |
CombiningAlgorithm |
getCombiningAlg()
Returns the combining algorithm used by this policy
|
List |
getCombiningParameters()
Returns the list of input parameters for the combining algorithm.
|
String |
getDefaultVersion()
Returns the XPath version to use or null if none was specified
|
String |
getDescription()
Returns the given description of this policy or null if there is no description
|
String |
getEnvPolicyValue() |
URI |
getId()
Returns the id of this policy
|
PolicyMetaData |
getMetaData()
Returns the meta-data associated with this policy
|
Set |
getObligationExpressions()
Returns the Set of obligations for this policy, which may be empty
|
String |
getResourcePolicyValue() |
String |
getSubjectPolicyValue() |
AbstractTarget |
getTarget()
Returns the target for this policy
|
String |
getVersion()
Returns the version of this policy.
|
MatchResult |
match(EvaluationCtx context)
Given the input context sees whether or not the request matches this policy.
|
void |
setActionPolicyValue(String actionPolicyValue) |
protected void |
setChildren(List<CombinerElement> children)
Sets the child policy tree elements for this node, which are passed to the combining
algorithm on evaluation.
|
void |
setEnvPolicyValue(String envPolicyValue) |
void |
setResourcePolicyValue(String resourcePolicyValue) |
void |
setSubjectPolicyValue(String subjectPolicyValue) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
encode, encode
protected PolicyMetaData metaData
protected AbstractPolicy()
PolicyReference
, which supplies its own values for the
methods in this class.protected AbstractPolicy(URI id, String version, CombiningAlgorithm combiningAlg, String description, AbstractTarget target)
id
- the policy idversion
- the policy version or null for the default (this is always null for pre-2.0
policies)combiningAlg
- the combining algorithm to usedescription
- describes the policy or null if there is nonetarget
- the policy's targetprotected AbstractPolicy(URI id, String version, CombiningAlgorithm combiningAlg, String description, AbstractTarget target, String defaultVersion)
id
- the policy idversion
- the policy version or null for the default (this is always null for pre-2.0
policies)combiningAlg
- the combining algorithm to usedescription
- describes the policy or null if there is nonetarget
- the policy's targetdefaultVersion
- the XPath version to use for selectorsprotected AbstractPolicy(URI id, String version, CombiningAlgorithm combiningAlg, String description, AbstractTarget target, String defaultVersion, Set<AbstractObligation> obligationExpressions, Set<AdviceExpression> adviceExpressions, List<CombinerParameter> parameters)
id
- the policy idversion
- the policy version or null for the default (this is always null for pre-2.0
policies)combiningAlg
- the combining algorithm to usedescription
- describes the policy or null if there is nonetarget
- the policy's targetdefaultVersion
- the XPath version to use for selectorsobligationExpressions
- the policy's ObligationExpressionsadviceExpressions
- the policy's advice expressionsparameters
- the policy's parametersprotected AbstractPolicy(Node root, String policyPrefix, String combiningName) throws ParsingException
root
- the DOM root of the policypolicyPrefix
- either "Policy" or "PolicySet"combiningName
- name of the field naming the combining alg
the XACML policy, if null use default factoriesParsingException
- if the policy is invalidpublic String getSubjectPolicyValue()
public void setSubjectPolicyValue(String subjectPolicyValue)
public String getResourcePolicyValue()
public void setResourcePolicyValue(String resourcePolicyValue)
public String getActionPolicyValue()
public void setActionPolicyValue(String actionPolicyValue)
public String getEnvPolicyValue()
public void setEnvPolicyValue(String envPolicyValue)
public URI getId()
getId
in interface PolicyTreeElement
public String getVersion()
"1.0"
.public CombiningAlgorithm getCombiningAlg()
public List getCombiningParameters()
List
of CombinerParameter
spublic String getDescription()
getDescription
in interface PolicyTreeElement
public AbstractTarget getTarget()
getTarget
in interface PolicyTreeElement
public String getDefaultVersion()
public List<PolicyTreeElement> getChildren()
List
of children under this node in the policy tree. Depending on
what kind of policy this node represents the children will either be
AbstractPolicy
objects or Rule
s.getChildren
in interface PolicyTreeElement
List
of child nodespublic List<CombinerElement> getChildElements()
List
of CombinerElement
s that is provided to the
combining algorithm. This returns the same set of children that getChildren
provides along with any associated combiner parameters.List
of CombinerElement
spublic Set getObligationExpressions()
public Set getAdviceExpressions()
public PolicyMetaData getMetaData()
public MatchResult match(EvaluationCtx context)
match
in interface PolicyTreeElement
context
- the representation of the requestprotected void setChildren(List<CombinerElement> children)
List
must contain CombinerElement
s,
which in turn will contain Rule
s or AbstractPolicy
s, but may not
contain both types of elements.children
- a List
of CombinerElement
s representing the child
elements used by the combining algorithmpublic AbstractResult evaluate(EvaluationCtx context)
match
method must always be called first, and must always return
MATCH, before this method is called.evaluate
in interface PolicyTreeElement
context
- the representation of the requestprotected void encodeCommonElements(StringBuilder builder)
Obligation
into its XML form and writes this out to the provided
StringBuilder
builder
- string stream into which the XML-encoded data is writtenCopyright © 2018 WSO2. All rights reserved.