Package org.keycloak.validate
Class AbstractStringValidator
java.lang.Object
org.keycloak.validate.AbstractSimpleValidator
org.keycloak.validate.AbstractStringValidator
- All Implemented Interfaces:
Provider
,ProviderFactory<Validator>
,SimpleValidator
,Validator
,ValidatorFactory
- Direct Known Subclasses:
EmailValidator
,LengthValidator
,LocalDateValidator
,OptionsValidator
,PatternValidator
,PersonNameProhibitedCharactersValidator
,UsernameProhibitedCharactersValidator
Base class for String value format validators. Functionality covered in this base class:
- accepts plain string and collections of strings as input
- each item is validated for collections of strings by
doValidate(String, String, ValidationContext, ValidatorConfig)
- null and empty values behavior should follow config, see
AbstractSimpleValidator
javadoc.
- Author:
- Vlastimil Elias <velias@redhat.com>
-
Field Summary
Fields inherited from class org.keycloak.validate.AbstractSimpleValidator
IGNORE_EMPTY_VALUE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doValidate
(Object value, String inputHint, ValidationContext context, ValidatorConfig config) Validate type, format, range of the value etc.protected abstract void
doValidate
(String value, String inputHint, ValidationContext context, ValidatorConfig config) protected boolean
skipValidation
(Object value, ValidatorConfig config) Decide if validation of individual value should be skipped or not.Methods inherited from class org.keycloak.validate.AbstractSimpleValidator
isIgnoreEmptyValuesConfigured, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.keycloak.provider.ProviderFactory
getConfigMetadata, getId, order
Methods inherited from interface org.keycloak.validate.SimpleValidator
close, create, init, postInit
Methods inherited from interface org.keycloak.validate.Validator
validate, validate, validate, validate, validate
Methods inherited from interface org.keycloak.validate.ValidatorFactory
validateConfig
-
Constructor Details
-
AbstractStringValidator
public AbstractStringValidator()
-
-
Method Details
-
doValidate
protected void doValidate(Object value, String inputHint, ValidationContext context, ValidatorConfig config) Description copied from class:AbstractSimpleValidator
Validate type, format, range of the value etc. Always useValidationContext.addError(ValidationError)
to report error to the user! Can be called multiple time for one validation if input is Collection.- Specified by:
doValidate
in classAbstractSimpleValidator
- Parameters:
value
- to be validated, never nullcontext
- for the validation. Add errors into it.config
- of the validation if provided- See Also:
-
doValidate
protected abstract void doValidate(String value, String inputHint, ValidationContext context, ValidatorConfig config) -
skipValidation
Description copied from class:AbstractSimpleValidator
Decide if validation of individual value should be skipped or not. It should be controlled byAbstractSimpleValidator.IGNORE_EMPTY_VALUE
configuration option, seeAbstractSimpleValidator.isIgnoreEmptyValuesConfigured(ValidatorConfig)
.- Specified by:
skipValidation
in classAbstractSimpleValidator
- Parameters:
value
- currently validated we make decision forconfig
- to look for options in- Returns:
- true if validation should be skipped for this value -
AbstractSimpleValidator.doValidate(Object, String, ValidationContext, ValidatorConfig)
is not called in this case. - See Also:
-