org.keycloak.userprofile.validator

## Class UsernameProhibitedCharactersValidator

- java.lang.Object
- - org.keycloak.validate.AbstractSimpleValidator
  - - org.keycloak.validate.AbstractStringValidator
    - - org.keycloak.userprofile.validator.UsernameProhibitedCharactersValidator

- All Implemented Interfaces:
    ConfiguredProvider, Provider, ProviderFactory<Validator>, SimpleValidator, Validator, ValidatorFactory

      public class UsernameProhibitedCharactersValidator
      extends AbstractStringValidator
      implements ConfiguredProvider

  This validator disallowing bunch of characters we really not to expect in username.

  Validates against hardcoded RegEx pattern - accepts plain string and collection of strings, for basic behavior like null/blank values handling and collections support see `AbstractStringValidator`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CFG_ERROR_MESSAGE`
    `static String` | `ID`
    `static UsernameProhibitedCharactersValidator` | `INSTANCE`
    `static String` | `MESSAGE_NO_MATCH`
    `protected static Pattern` | `PATTERN`

    - ### Fields inherited from class org.keycloak.validate.AbstractSimpleValidator

      `IGNORE_EMPTY_VALUE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UsernameProhibitedCharactersValidator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doValidate(String value, String inputHint, ValidationContext context, ValidatorConfig config)`
    `List<ProviderConfigProperty>` | `getConfigProperties()`
    `String` | `getHelpText()`
    `String` | `getId()`

    - ### Methods inherited from class org.keycloak.validate.AbstractStringValidator

      `doValidate, skipValidation`

    - ### 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.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`

    - ### Methods inherited from interface org.keycloak.provider.ProviderFactory

      `order`

- - ### Field Detail

    - #### ID

          public static final String ID

      See Also:
        Constant Field Values

    - #### INSTANCE

          public static final UsernameProhibitedCharactersValidator INSTANCE

    - #### PATTERN

          protected static final Pattern PATTERN

    - #### MESSAGE_NO_MATCH

          public static final String MESSAGE_NO_MATCH

      See Also:
        Constant Field Values

    - #### CFG_ERROR_MESSAGE

          public static final String CFG_ERROR_MESSAGE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### UsernameProhibitedCharactersValidator

          public UsernameProhibitedCharactersValidator()

  - ### Method Detail

    - #### getId

          public String getId()

      Specified by:
        `getId` in interface `ProviderFactory<Validator>`

    - #### doValidate

          protected void doValidate(String value,
                                    String inputHint,
                                    ValidationContext context,
                                    ValidatorConfig config)

      Specified by:
        `doValidate` in class `AbstractStringValidator`

    - #### getHelpText

          public String getHelpText()

      Specified by:
        `getHelpText` in interface `ConfiguredProvider`

    - #### getConfigProperties

          public List<ProviderConfigProperty> getConfigProperties()

      Specified by:
        `getConfigProperties` in interface `ConfiguredProvider`

Copyright © 2021 JBoss by Red Hat. All rights reserved.