public interface ValidationRule
Modifier and Type | Method and Description |
---|---|
void |
assertValid(String context,
String input)
Check if the input is valid, throw an Exception otherwise
|
Object |
getSafe(String context,
String input)
Try to call
getvalid , then call a 'sanitize' method for sanitization (if one exists),
finally return a default value. |
String |
getTypeName()
Programmatically supplied name for the validator
|
Object |
getValid(String context,
String input)
Parse the input, throw exceptions if validation fails
|
Object |
getValid(String context,
String input,
ValidationErrorList errorList)
Get a validated value, add the errors to an existing error list
|
boolean |
isValid(String context,
String input) |
void |
setAllowNull(boolean flag)
Whether or not a valid valid can be null.
|
void |
setEncoder(Encoder encoder) |
void |
setTypeName(String typeName) |
String |
whitelist(String input,
char[] list)
String the input of all chars contained in the list
|
String |
whitelist(String input,
Set<Character> list)
String the input of all chars contained in the list
|
Object getValid(String context, String input) throws ValidationException
context
- for logginginput
- the value to be parsedValidationException
- if any validation rules fail, except if the
ESAPI.properties
> property
"Validator.ValidationRule.getValid.ignore509Fix" is set to
true
, which is the default behavior for ESAPI 2.x
releases. See ESAPI GitHub Issues
521
for futher details.getValid(String context, String input, ValidationErrorList errorList)
void setAllowNull(boolean flag)
getValid
will throw an
Exception and {#code getSafe} will return the default value if flag is set to
trueflag
- whether or not null values are valid/safeString getTypeName()
void setTypeName(String typeName)
typeName
- a name, describing the validatorvoid setEncoder(Encoder encoder)
encoder
- the encoder to usevoid assertValid(String context, String input) throws ValidationException
ValidationException
Object getValid(String context, String input, ValidationErrorList errorList) throws ValidationException
ValidationException
Object getSafe(String context, String input)
getvalid
, then call a 'sanitize' method for sanitization (if one exists),
finally return a default value.String whitelist(String input, char[] list)
Copyright © 2022 The Open Web Application Security Project (OWASP). All rights reserved.