InputValidatorValve
Note
This valve can validate a value (a string) against a ruleset, and if any of the rules doesn't validate correctly, the flow will fail.
Properties
Name | Description | Default value | Mandatory | Supports property expansion |
---|---|---|---|---|
value | The value to validate. | Yes | Yes | |
rules | The ruleset. A serialized JSON array | Yes | Yes | |
verbose | Whether to be verbose during the validation or not | false | No | Yes |
Example Configuration
{
"name": "InputValidatorValve",
"enabled": "true",
"config": {
"value": "{{request.password}}",
"rules": "{{request.rules}}",
"verbose": "true"
}
}
In the example above, the expanded value of {{request.password}}
will be validated against the expanded rules of {{request.rules}}
. request.rules
is expected to contain a JSON array with validation rules:
Either directly as a JSON array, serialized as a string, or
As a template expansion
Example Rules
This is a an example of a ruleset that can be fed to the "rules" property above.
[
{
name: "pwdreset.rules.min_chars",
regex: "^.{8,}$",
enabled: true
},
{
name: "pwdreset.rules.max_chars",
regex: "^.{1,32}$",
enabled: true
},
{
name: "pwdreset.rules.digit",
regex: "^.*[0-9]+.*$",
enabled: true
},
{
name: "pwdreset.rules.upper_case_char",
regex: "^.*[A-Z]+.*$",
enabled: true
},
{
name: "pwdreset.rules.lower_case_char",
regex: "^.*[a-z]+.*$",
enabled: true
},
{
name: "pwdreset.rules.special_char",
regex: "^.*[^A-Za-z0-9]+.*$",
enabled: true
}
]