id: query-param-filter
name: Query Param Filter
description: Filters query parameters
category: Security
type: custom
standalone: true
requiresConnectivity: false
resourceLevelSupported: true
providedCharacteristics: []
requiredCharacteristics: []
To Create the Custom Policy Definition File
In this procedure, you create a YAML file that contains the policy definition file. Next, to filter calls to the API, the policy definition includes a query parameter and a regular expression to filter the query parameter. Unmatched requests are rejected. Properties map to the elements in the UI when you apply the policy. At the end of this procedure, you can download the complete file.
-
Open a new text file, and define the required properties for a policy in Anypoint Platform.
-
Add the
resourceLevelSupported: true
property if you run Mule 3.8.1 or later. This property supports resource level policies. -
Add a configuration element and two propertyName fields having the values regexFilter and queryParam.
-
Add properties to define the regular expression to filter the parameter and to name and define the query parameter that must be evaluated.
id: query-param-filter name: Query Param Filter description: Filters query parameters category: Security type: custom standalone: true requiresConnectivity: false resourceLevelSupported: true providedCharacteristics: [] requiredCharacteristics: [] configuration: - propertyName: regexFilter name: Regex Filter description: A regular expression to filter a query parameter. Rejects unmatched requests. type: string defaultValue: optional: true sensitive: false allowMultiple: false - propertyName: queryParam name: Query Parameter description: Name of a query parameter to filter by a regular expression. type: string defaultValue: optional: false sensitive: false allowMultiple: false
-
Save the file using a
.yaml
extension. For example, save the file asmypolicy.yaml
.