Look Up Context Variable Assertion
The Look Up Context Variable assertion is used to dynamically look up the value of a context variable and then store the value in another context variable. You specify an expression, which can contain one or more context variables plus static text. During runtime, this expression is resolved and its value is placed in another context variable, which can then be used later in the policy.
gateway90
The
Look Up Context Variable
assertion is used to dynamically look up the value of a context variable and then store the value in another context variable. You specify an expression, which can contain one or more context variables plus static text. During runtime, this expression is resolved and its value is placed in another context variable, which can then be used later in the policy.Example
:Consider the following variables and their values:
- foo =bar
- ingredient =chocolate
- chocolate.bar =goodness
In the Look Up Context Variable assertion, enter the following expression:
${
ingredient
}.${foo
}And keep the default prefix:
lookup
The expression will resolve to
chocolate.bar
, which becomes the variable to be looked up by the assertion. The variable chocolate.bar contains the value "goodness", so this is placed in the assertion variable lookup.output
. You can then reference ${lookup
.output
} elsewhere in the policy to retrieve the value "goodness".Context Variables Created by This Assertion
The Look Up Context Variable assertion sets the following context variables.
The default <
prefix
> is "lookup" and can be changed in the assertion properties.Variable | Description |
---|---|
< prefix >.found | Contains true if the expression was found, otherwise contains false. |
< prefix >.multivalued | Contains true if the value found in the expression is multivalued. Contains false if the value is not multivalued or if the expression is not found. |
< prefix >.output | Contains the value of the expression. For more information on what is populated into this variable, see the example in the topic introduction. |
Using the Assertion
- Do one of the following:
- To add the assertion to the Policy Development window, see Add an Assertion.
- To change the configuration of an existing assertion, proceed to step 2 below.
- When adding the assertion, theLook Up Context Variable Propertiesautomatically appears. When modifying the assertion, right-click<in the policy window and selecttarget>: Look Up Context VariableLook Up Context Variable Propertiesor double-click the assertion in the policy window. The assertion properties are displayed.
- Configure the properties as follows:SettingDescriptionExpressionSpecify the source context variables to evaluate. You can enter more than one variable but note the following limitations:
- Nested context variables are not supported (for example, ${foo.${bar}}).
- All variables must be on the same level (for example, ${foo}.${bar}).
When referencing multivalued context variables, you can use indexing to extract a single value. For more information, see Indexing Options during Interpolation.Fail if not foundSelect this check box to fail the assertion if the variable in the Expression does not exist. This setting is the default.Clear this check box to not fail the assertion if the variable is not found.Target Data TypeChoose the data type for the target value returned:String,Date/Time,X.509 Certificate,XML Element, orMessage.Target Variable PrefixEnter a prefix that will be added to the context variables created by this assertion. This prefix will ensure uniqueness and will prevent the variables from overwriting each other when multiple instances of this assertion appear in a policy.The default variable prefix is lookup.For an explanation of the validation messages displayed, see Context Variable Validation. - Click [OK] when done.