org.keycloak.credential

## Class CredentialTypeMetadata

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

- All Implemented Interfaces:
    Comparable<CredentialTypeMetadata>

      public class CredentialTypeMetadata
      extends Object
      implements Comparable<CredentialTypeMetadata>

  Author:
    Marek Posolda

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CredentialTypeMetadata.Category`
    `static class` | `CredentialTypeMetadata.CredentialTypeMetadataBuilder`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_ICON_CSS_CLASS`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static CredentialTypeMetadata.CredentialTypeMetadataBuilder` | `builder()`
    `int` | `compareTo(CredentialTypeMetadata other)`
    `CredentialTypeMetadata.Category` | `getCategory()`
    `String` | `getCreateAction()`
    `String` | `getDisplayName()`
    `String` | `getHelpText()`
    `String` | `getIconCssClass()` Return the icon CSS, which can be used to display icon, which represents this particular authenticator.
    `String` | `getType()`
    `String` | `getUpdateAction()`
    `boolean` | `isRemoveable()`

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

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

- - ### Field Detail

    - #### DEFAULT_ICON_CSS_CLASS

          public static final String DEFAULT_ICON_CSS_CLASS

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getType

          public String getType()

      Returns:
        credential type like for example "password", "otp" or "webauthn"

    - #### getDisplayName

          public String getDisplayName()

      Returns:
        the label, which will be shown to the end user on various screens, like login screen with available authentication mechanisms. This label will reference this particular authenticator type. It should be clear to end users. For example, implementations can return "Authenticator Application" for OTP or "Security Key" for WebAuthn. Alternatively, this method can return a message key, so that it is possible to localize it for various languages.

    - #### getHelpText

          public String getHelpText()

      Returns:
        the text, which will be shown to the user on various screens, like login screen with available authentication mechanisms. This text will reference this particular authenticator type. For example for OTP, the returned text could be "Enter a verification code from authenticator application" . Alternatively, this method can return a message key, so that it is possible to localize it for various languages.

    - #### getIconCssClass

          public String getIconCssClass()

      Return the icon CSS, which can be used to display icon, which represents this particular authenticator. The icon will be displayed on various places. For example the "Select authenticator" screen during login, where user can select from various authentication mechanisms for two-factor or passwordless authentication. The returned value can be either: - Key of the property, which will reference the actual CSS in the themes.properties file. For example if you return "kcAuthenticatorWebAuthnClass" from this method, then your themes.properties should have the property like for example "kcAuthenticatorWebAuthnClass=fa fa-key list-view-pf-icon-lg" . This would mean that "fa fa-key list-view-pf-icon-lg" will be the actual CSS used. - the icon CSS class directly. For example you can return "fa fa-key list-view-pf-icon-lg" directly for the above example with WebAuthn. This alternative is fine just if your authenticator can use same CSS class for all the themes. If you don't expect your authenticator to need icon (for example it will never be shown in the "select authenticator" screen), then it is fine to keep the default value.

    - #### getCreateAction

          public String getCreateAction()

      Returns:
        the providerID of the required action, which can be used by the user to create new credential of our type. Null if there is no action for creating credential. For example we're creating credential in case of "otp" type, but we're updating credential in case of type "password"

    - #### getUpdateAction

          public String getUpdateAction()

      Returns:
        the providerID of the required action, which can be used by the user to update credential of our type. Null if there is no action for updating credential. For example we're creating credential in case of "otp" type, but we're updating credential in case of type "password"

    - #### isRemoveable

          public boolean isRemoveable()

      Returns:
        true if user can remove some previously registered credentials of this type.

    - #### getCategory

          public CredentialTypeMetadata.Category getCategory()

      Returns:
        Category of this credential

    - #### builder

          public static CredentialTypeMetadata.CredentialTypeMetadataBuilder builder()

    - #### compareTo

          public int compareTo(CredentialTypeMetadata other)

      Specified by:
        `compareTo` in interface `Comparable<CredentialTypeMetadata>`

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