Switch on Attribute Value

Contents

Overview

The Switch on attribute value filter enables you to switch to a specific policy based on the value of a configured message attribute. You can specify various switch cases (for example, contains, is, ends with, matches regular expression, and so on). Specified switch cases are evaluated in succession until a switch case is found, and the policy specified for that case is then executed. You can also specify a default policy, which is executed when none of the switch cases specified in the filter are found.

The Switch on attribute value filter is available from the Utility category of filters. You can drag and drop this filter from the filter palette on to the policy editor canvas in the Policy Studio, and configure it to meet the requirements of your policy.

Configuration

Complete the following configuration settings in the Switch on attribute value screen:

Name:
Enter an intuitive name for the filter. For example, the name might reflect the business logic of a specified switch case.

Switch on attribute:
Enter or select the name of the message attribute to switch on (for example, http.request.path). This filter examines the message attribute value, and switches to the specified policy if this value meets a configured switch case.

Case:
You can add, edit, and delete switch cases by clicking the appropriate button on the right. All configured switch cases are displayed in the table on this screen. For more details, see Adding a Switch Case.

Default:
This field specifies the default behavior of the filter when none of the specified switch cases are found in the configured message attribute value. Select one of the following options:
Return result of calling the following policy Click the browse button, and select a default policy to execute from the dialog (for example, XML Threat Policy). The filter returns the result of the specified policy. This option is selected by default.
Return true The filter returns true.
Return false The filter returns false.

Adding a Switch Case

To add a switch case, click the Add button, and configure the following fields in the dialog:

Comparison Type:
Select the comparison type that you wish to perform with the configured message attribute. The available options include the following:

  • Contains
  • Doesn't Contain
  • Ends With
  • Is
  • Isn't
  • Matches Regular Expression
  • Starts With

All of these options are case insensitive, except for Matches Regular Expression.

Compare with:
Enter the value to compare the configured message attribute value with. For example, if you select a Comparison Type of Matches Regular Expression, enter the regular expression in this field.

Policy:
Click the browse button next to the Policy field, and select the policy to execute from the dialog (for example, Remove All Security Tokens). You can search for a specific policy by entering its name in the text box, and the policy tree is filtered automatically. The selected policy is executed when this switch case is found.

Click OK when finished. You can click Add, and repeat as necessary to add more switch cases to this filter. The switch cases are examined in the order in which they are listed in the table. You can alter the sequence in which the switch cases are evaluated by selecting a policy in the table and clicking the Up and Down buttons on the right.