Class BlankAttributeValidator
- java.lang.Object
-
- org.keycloak.userprofile.validator.BlankAttributeValidator
-
- All Implemented Interfaces:
Provider
,ProviderFactory<Validator>
,SimpleValidator
,Validator
,ValidatorFactory
public class BlankAttributeValidator extends Object implements SimpleValidator
Validator to check that User Profile attribute value is not blank (null value is OK!). Expects List of Strings as input.- Author:
- Vlastimil Elias
-
-
Field Summary
Fields Modifier and Type Field Description static String
CFG_ERROR_MESSAGE
static String
CFG_FAIL_ON_NULL
static String
ID
-
Constructor Summary
Constructors Constructor Description BlankAttributeValidator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ValidatorConfig
createConfig(String errorMessage, boolean failOnNull)
Create config for this validator to get customized error messageString
getId()
ValidationContext
validate(Object input, String inputHint, ValidationContext context, ValidatorConfig config)
Validates the giveninput
with an additionalinputHint
andconfig
.-
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, 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, validate
-
Methods inherited from interface org.keycloak.validate.ValidatorFactory
validateConfig
-
-
-
-
Field Detail
-
ID
public static final String ID
- See Also:
- Constant Field Values
-
CFG_ERROR_MESSAGE
public static final String CFG_ERROR_MESSAGE
- See Also:
- Constant Field Values
-
CFG_FAIL_ON_NULL
public static final String CFG_FAIL_ON_NULL
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
public String getId()
- Specified by:
getId
in interfaceProviderFactory<Validator>
-
validate
public ValidationContext validate(Object input, String inputHint, ValidationContext context, ValidatorConfig config)
Description copied from interface:Validator
Validates the giveninput
with an additionalinputHint
andconfig
.
-
createConfig
public static ValidatorConfig createConfig(String errorMessage, boolean failOnNull)
Create config for this validator to get customized error message- Parameters:
errorMessage
- to be used if validation failsfailOnNull
- makes validator fail on null values also (not on empty string only as is the default behavior)- Returns:
- config
-
-