org.keycloak.models.utils

## Class CredentialValidation

- java.lang.Object
- - org.keycloak.models.utils.CredentialValidation

-     public class CredentialValidation
      extends Object

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CredentialValidation()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `validateHashedCredential(KeycloakSession session, RealmModel realm, UserModel user, String unhashedCredValue, UserCredentialValueModel credential)`
    `static boolean` | `validCredential(KeycloakSession session, RealmModel realm, UserModel user, UserCredentialModel credential)`
    `static boolean` | `validCredentials(KeycloakSession session, RealmModel realm, UserModel user, List<UserCredentialModel> credentials)` Must validate all credentials.
    `static boolean` | `validCredentials(KeycloakSession session, RealmModel realm, UserModel user, UserCredentialModel... credentials)` Must validate all credentials.
    `static boolean` | `validHOTP(RealmModel realm, UserModel user, String otp)`
    `static boolean` | `validOTP(RealmModel realm, String token, String secret)`
    `static boolean` | `validPassword(KeycloakSession session, RealmModel realm, UserModel user, String password)` Will update password if hash iteration policy has changed
    `static boolean` | `validPasswordToken(RealmModel realm, UserModel user, String encodedPasswordToken)`
    `static boolean` | `validSecret(RealmModel realm, UserModel user, String secret)`
    `static boolean` | `validTOTP(RealmModel realm, UserModel user, String otp)`

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

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

- - ### Constructor Detail

    - #### CredentialValidation

          public CredentialValidation()

  - ### Method Detail

    - #### validPassword

          public static boolean validPassword(KeycloakSession session,
                                              RealmModel realm,
                                              UserModel user,
                                              String password)

      Will update password if hash iteration policy has changed
      Parameters:
        `realm` -
        `user` -
        `password` -
      Returns:

    - #### validateHashedCredential

          public static boolean validateHashedCredential(KeycloakSession session,
                                                         RealmModel realm,
                                                         UserModel user,
                                                         String unhashedCredValue,
                                                         UserCredentialValueModel credential)

    - #### validPasswordToken

          public static boolean validPasswordToken(RealmModel realm,
                                                   UserModel user,
                                                   String encodedPasswordToken)

    - #### validHOTP

          public static boolean validHOTP(RealmModel realm,
                                          UserModel user,
                                          String otp)

    - #### validOTP

          public static boolean validOTP(RealmModel realm,
                                         String token,
                                         String secret)

    - #### validTOTP

          public static boolean validTOTP(RealmModel realm,
                                          UserModel user,
                                          String otp)

    - #### validSecret

          public static boolean validSecret(RealmModel realm,
                                            UserModel user,
                                            String secret)

    - #### validCredentials

          public static boolean validCredentials(KeycloakSession session,
                                                 RealmModel realm,
                                                 UserModel user,
                                                 List<UserCredentialModel> credentials)

      Must validate all credentials. FYI, password hashes may be rehashed and updated based on realm hash password policies.
      Parameters:
        `realm` -
        `user` -
        `credentials` -
      Returns:

    - #### validCredentials

          public static boolean validCredentials(KeycloakSession session,
                                                 RealmModel realm,
                                                 UserModel user,
                                                 UserCredentialModel... credentials)

      Must validate all credentials. FYI, password hashes may be rehashed and updated based on realm hash password policies.
      Parameters:
        `realm` -
        `user` -
        `credentials` -
      Returns:

    - #### validCredential

          public static boolean validCredential(KeycloakSession session,
                                                RealmModel realm,
                                                UserModel user,
                                                UserCredentialModel credential)

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