org.keycloak.credential

## Class CredentialModel

- java.lang.Object
- - org.keycloak.credential.CredentialModel

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    OTPCredentialModel, PasswordCredentialModel, WebAuthnCredentialModel

      public class CredentialModel
      extends Object
      implements Serializable

  Used just in cases when we want to "directly" update or retrieve the hash or salt of user credential (For example during export/import)
  Author:
    Marek Posolda
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CLIENT_CERT`
    `static String` | `HOTP` Deprecated.
    `static String` | `KERBEROS`
    `static String` | `OTP` Deprecated.
    `static String` | `PASSWORD` Deprecated.
    `static String` | `PASSWORD_HISTORY` Deprecated.
    `static String` | `PASSWORD_TOKEN` Deprecated.
    `static String` | `SECRET`
    `static String` | `TOTP` Deprecated.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CredentialModel()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Comparator<CredentialModel>` | `comparingByStartDateDesc()`
    `String` | `getAlgorithm()` Deprecated. Recommended to use PasswordCredentialModel.getCredentialData().getAlgorithm() or OTPCredentialModel.getCredentialData().getAlgorithm()
    `MultivaluedHashMap<String,String>` | `getConfig()` Deprecated. Recommended to use `getCredentialData()` instead and use the subtype of CredentialData specific to your credential
    `int` | `getCounter()` Deprecated. Recommended to use OTPCredentialModel.getCredentialData().getCounter()
    `Long` | `getCreatedDate()`
    `String` | `getCredentialData()`
    `String` | `getDevice()` Deprecated. Recommended to use OTPCredentialModel.getCredentialData().getDevice()
    `int` | `getDigits()` Deprecated. Recommended to use OTPCredentialModel.getCredentialData().getDigits()
    `int` | `getHashIterations()` Deprecated. Recommended to use PasswordCredentialModel.getCredentialData().getHashIterations()
    `String` | `getId()`
    `int` | `getPeriod()` Deprecated. Recommended to use OTPCredentialModel.getCredentialData().getPeriod()
    `byte[]` | `getSalt()` Deprecated. Recommended to use PasswordCredentialModel.getSecretData().getSalt()
    `String` | `getSecretData()`
    `String` | `getType()`
    `String` | `getUserLabel()`
    `String` | `getValue()` Deprecated. Recommended to use PasswordCredentialModel.getSecretData().getValue() or OTPCredentialModel.getSecretData().getValue()
    `void` | `setAlgorithm(String algorithm)` Deprecated. See `getAlgorithm()`
    `void` | `setConfig(MultivaluedHashMap<String,String> config)` Deprecated. Recommended to use `setCredentialData(String)` instead and use the subtype of CredentialData specific to your credential
    `void` | `setCounter(int counter)` Deprecated. See `getCounter()`
    `void` | `setCreatedDate(Long createdDate)`
    `void` | `setCredentialData(String credentialData)`
    `void` | `setDevice(String device)` Deprecated. See `getDevice()`
    `void` | `setDigits(int digits)` Deprecated. See `setDigits(int)`
    `void` | `setHashIterations(int iterations)` Deprecated. See `getHashIterations()`
    `void` | `setId(String id)`
    `void` | `setPeriod(int period)` Deprecated. See `setPeriod(int)`
    `void` | `setSalt(byte[] salt)` Deprecated. See `getSalt()`
    `void` | `setSecretData(String secretData)`
    `void` | `setType(String type)`
    `void` | `setUserLabel(String userLabel)`
    `void` | `setValue(String value)` Deprecated. See `getValue()`
    `CredentialModel` | `shallowClone()`

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

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

- - ### Field Detail

    - #### PASSWORD

          @Deprecated
          public static final String PASSWORD

      Deprecated.
      See Also:
        Constant Field Values

    - #### PASSWORD_HISTORY

          @Deprecated
          public static final String PASSWORD_HISTORY

      Deprecated.
      See Also:
        Constant Field Values

    - #### PASSWORD_TOKEN

          @Deprecated
          public static final String PASSWORD_TOKEN

      Deprecated.
      See Also:
        Constant Field Values

    - #### OTP

          @Deprecated
          public static final String OTP

      Deprecated.
      See Also:
        Constant Field Values

    - #### TOTP

          @Deprecated
          public static final String TOTP

      Deprecated.
      See Also:
        Constant Field Values

    - #### HOTP

          @Deprecated
          public static final String HOTP

      Deprecated.
      See Also:
        Constant Field Values

    - #### SECRET

          public static final String SECRET

      See Also:
        Constant Field Values

    - #### CLIENT_CERT

          public static final String CLIENT_CERT

      See Also:
        Constant Field Values

    - #### KERBEROS

          public static final String KERBEROS

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CredentialModel

          public CredentialModel()

  - ### Method Detail

    - #### shallowClone

          public CredentialModel shallowClone()

    - #### getId

          public String getId()

    - #### setId

          public void setId(String id)

    - #### getType

          public String getType()

    - #### setType

          public void setType(String type)

    - #### getUserLabel

          public String getUserLabel()

    - #### setUserLabel

          public void setUserLabel(String userLabel)

    - #### getCreatedDate

          public Long getCreatedDate()

    - #### setCreatedDate

          public void setCreatedDate(Long createdDate)

    - #### getSecretData

          public String getSecretData()

    - #### setSecretData

          public void setSecretData(String secretData)

    - #### getCredentialData

          public String getCredentialData()

    - #### setCredentialData

          public void setCredentialData(String credentialData)

    - #### comparingByStartDateDesc

          public static Comparator<CredentialModel> comparingByStartDateDesc()

    - #### getValue

          @Deprecated
          public String getValue()

      Deprecated. Recommended to use PasswordCredentialModel.getSecretData().getValue() or OTPCredentialModel.getSecretData().getValue()

    - #### setValue

          @Deprecated
          public void setValue(String value)

      Deprecated. See `getValue()`

    - #### getDevice

          @Deprecated
          public String getDevice()

      Deprecated. Recommended to use OTPCredentialModel.getCredentialData().getDevice()

    - #### setDevice

          @Deprecated
          public void setDevice(String device)

      Deprecated. See `getDevice()`

    - #### getSalt

          @Deprecated
          public byte[] getSalt()

      Deprecated. Recommended to use PasswordCredentialModel.getSecretData().getSalt()

    - #### setSalt

          @Deprecated
          public void setSalt(byte[] salt)

      Deprecated. See `getSalt()`

    - #### getHashIterations

          @Deprecated
          public int getHashIterations()

      Deprecated. Recommended to use PasswordCredentialModel.getCredentialData().getHashIterations()

    - #### setHashIterations

          @Deprecated
          public void setHashIterations(int iterations)

      Deprecated. See `getHashIterations()`

    - #### getCounter

          @Deprecated
          public int getCounter()

      Deprecated. Recommended to use OTPCredentialModel.getCredentialData().getCounter()

    - #### setCounter

          @Deprecated
          public void setCounter(int counter)

      Deprecated. See `getCounter()`

    - #### getAlgorithm

          @Deprecated
          public String getAlgorithm()

      Deprecated. Recommended to use PasswordCredentialModel.getCredentialData().getAlgorithm() or OTPCredentialModel.getCredentialData().getAlgorithm()

    - #### setAlgorithm

          @Deprecated
          public void setAlgorithm(String algorithm)

      Deprecated. See `getAlgorithm()`

    - #### getDigits

          @Deprecated
          public int getDigits()

      Deprecated. Recommended to use OTPCredentialModel.getCredentialData().getDigits()

    - #### setDigits

          @Deprecated
          public void setDigits(int digits)

      Deprecated. See `setDigits(int)`

    - #### getPeriod

          @Deprecated
          public int getPeriod()

      Deprecated. Recommended to use OTPCredentialModel.getCredentialData().getPeriod()

    - #### setPeriod

          @Deprecated
          public void setPeriod(int period)

      Deprecated. See `setPeriod(int)`

    - #### getConfig

          @Deprecated
          public MultivaluedHashMap<String,String> getConfig()

      Deprecated. Recommended to use `getCredentialData()` instead and use the subtype of CredentialData specific to your credential

    - #### setConfig

          @Deprecated
          public void setConfig(MultivaluedHashMap<String,String> config)

      Deprecated. Recommended to use `setCredentialData(String)` instead and use the subtype of CredentialData specific to your credential

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