org.keycloak.models.credential

## Class OTPCredentialModel

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

- All Implemented Interfaces:
    Serializable

      public class OTPCredentialModel
      extends CredentialModel

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `HOTP`
    `static String` | `TOTP`
    `static String` | `TYPE`

    - ### Fields inherited from class org.keycloak.credential.CredentialModel

      `CLIENT_CERT, KERBEROS, OTP, PASSWORD, PASSWORD_HISTORY, PASSWORD_TOKEN, SECRET`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static OTPCredentialModel` | `createFromCredentialModel(CredentialModel credentialModel)`
    `static OTPCredentialModel` | `createFromPolicy(RealmModel realm, String secretValue)`
    `static OTPCredentialModel` | `createFromPolicy(RealmModel realm, String secretValue, String userLabel)`
    `static OTPCredentialModel` | `createHOTP(String secretValue, int digits, int counter, String algorithm)`
    `static OTPCredentialModel` | `createTOTP(String secretValue, int digits, int period, String algorithm)`
    `OTPCredentialData` | `getOTPCredentialData()`
    `OTPSecretData` | `getOTPSecretData()`
    `void` | `updateCounter(int counter)`

    - ### Methods inherited from class org.keycloak.credential.CredentialModel

      `comparingByStartDateDesc, getAlgorithm, getConfig, getCounter, getCreatedDate, getCredentialData, getDevice, getDigits, getHashIterations, getId, getPeriod, getSalt, getSecretData, getType, getUserLabel, getValue, setAlgorithm, setConfig, setCounter, setCreatedDate, setCredentialData, setDevice, setDigits, setHashIterations, setId, setPeriod, setSalt, setSecretData, setType, setUserLabel, setValue, shallowClone`

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

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

- - ### Field Detail

    - #### TYPE

          public static final String TYPE

      See Also:
        Constant Field Values

    - #### TOTP

          public static final String TOTP

      See Also:
        Constant Field Values

    - #### HOTP

          public static final String HOTP

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### createTOTP

          public static OTPCredentialModel createTOTP(String secretValue,
                                                      int digits,
                                                      int period,
                                                      String algorithm)

    - #### createHOTP

          public static OTPCredentialModel createHOTP(String secretValue,
                                                      int digits,
                                                      int counter,
                                                      String algorithm)

    - #### createFromPolicy

          public static OTPCredentialModel createFromPolicy(RealmModel realm,
                                                            String secretValue)

    - #### createFromPolicy

          public static OTPCredentialModel createFromPolicy(RealmModel realm,
                                                            String secretValue,
                                                            String userLabel)

    - #### createFromCredentialModel

          public static OTPCredentialModel createFromCredentialModel(CredentialModel credentialModel)

    - #### updateCounter

          public void updateCounter(int counter)

    - #### getOTPCredentialData

          public OTPCredentialData getOTPCredentialData()

    - #### getOTPSecretData

          public OTPSecretData getOTPSecretData()

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