org.keycloak.services.validation

## Class Validation

- java.lang.Object
- - org.keycloak.services.validation.Validation

-     public class Validation
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `FIELD_EMAIL`
    `static String` | `FIELD_FIRST_NAME`
    `static String` | `FIELD_LAST_NAME`
    `static String` | `FIELD_OTP_CODE`
    `static String` | `FIELD_OTP_LABEL`
    `static String` | `FIELD_PASSWORD`
    `static String` | `FIELD_PASSWORD_CONFIRM`
    `static String` | `FIELD_USERNAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Validation()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static List<FormMessage>` | `getFormErrorsFromValidation(UserProfileValidationResult results)`
    `static boolean` | `isBlank(String s)` Check if string is blank (null or lenght is 0 or contains only white characters)
    `static boolean` | `isEmailValid(String email)`
    `static boolean` | `isEmpty(String s)` Check if string is empty (null or lenght is 0)
    `static List<FormMessage>` | `validateRegistrationForm(KeycloakSession session, RealmModel realm, javax.ws.rs.core.MultivaluedMap<String,String> formData, List<String> requiredCredentialTypes, PasswordPolicy policy)`
    `static List<FormMessage>` | `validateUpdateProfileForm(RealmModel realm, javax.ws.rs.core.MultivaluedMap<String,String> formData)`
    `static List<FormMessage>` | `validateUpdateProfileForm(RealmModel realm, javax.ws.rs.core.MultivaluedMap<String,String> formData, boolean userNameRequired)`
    `static boolean` | `validateUserMandatoryFields(RealmModel realm, UpdateProfileContext user)` Validate if user object contains all mandatory fields.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### FIELD_PASSWORD_CONFIRM

          public static final String FIELD_PASSWORD_CONFIRM

      See Also:
        Constant Field Values

    - #### FIELD_EMAIL

          public static final String FIELD_EMAIL

      See Also:
        Constant Field Values

    - #### FIELD_LAST_NAME

          public static final String FIELD_LAST_NAME

      See Also:
        Constant Field Values

    - #### FIELD_FIRST_NAME

          public static final String FIELD_FIRST_NAME

      See Also:
        Constant Field Values

    - #### FIELD_PASSWORD

          public static final String FIELD_PASSWORD

      See Also:
        Constant Field Values

    - #### FIELD_USERNAME

          public static final String FIELD_USERNAME

      See Also:
        Constant Field Values

    - #### FIELD_OTP_CODE

          public static final String FIELD_OTP_CODE

      See Also:
        Constant Field Values

    - #### FIELD_OTP_LABEL

          public static final String FIELD_OTP_LABEL

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Validation

          public Validation()

  - ### Method Detail

    - #### validateRegistrationForm

          public static List<FormMessage> validateRegistrationForm(KeycloakSession session,
                                                                   RealmModel realm,
                                                                   javax.ws.rs.core.MultivaluedMap<String,String> formData,
                                                                   List<String> requiredCredentialTypes,
                                                                   PasswordPolicy policy)

    - #### validateUpdateProfileForm

          public static List<FormMessage> validateUpdateProfileForm(RealmModel realm,
                                                                    javax.ws.rs.core.MultivaluedMap<String,String> formData)

    - #### validateUpdateProfileForm

          public static List<FormMessage> validateUpdateProfileForm(RealmModel realm,
                                                                    javax.ws.rs.core.MultivaluedMap<String,String> formData,
                                                                    boolean userNameRequired)

    - #### validateUserMandatoryFields

          public static boolean validateUserMandatoryFields(RealmModel realm,
                                                            UpdateProfileContext user)

      Validate if user object contains all mandatory fields.
      Parameters:
        `realm` - user is for
        `user` - to validate
      Returns:
        true if user object contains all mandatory values, false if some mandatory value is missing

    - #### isEmpty

          public static boolean isEmpty(String s)

      Check if string is empty (null or lenght is 0)
      Parameters:
        `s` - to check
      Returns:
        true if string is empty

    - #### isBlank

          public static boolean isBlank(String s)

      Check if string is blank (null or lenght is 0 or contains only white characters)
      Parameters:
        `s` - to check
      Returns:
        true if string is blank

    - #### isEmailValid

          public static boolean isEmailValid(String email)

    - #### getFormErrorsFromValidation

          public static List<FormMessage> getFormErrorsFromValidation(UserProfileValidationResult results)

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