Uploaded image for project: 'Red Hat build of Keycloak'
  1. Red Hat build of Keycloak
  2. RHBK-1863

Declarative User Profile: The use of the "select-radiobuttons" with options validation display is broken [GHI#28443]

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      Before reporting an issue

      [X] I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

      Area

      user-profile

      Describe the bug

      Starting with Keycloak 24.0.2, when creating a user profile with a "select-radiobuttons" with options validation "on" and "off", in the display the first option is rendered as "n" and the second one is empty.

      Here is the display in the keycloak admin, user detail page.
      !image

      The problem exist too in the account page for the personnal info, with exactly the same bug.

      Please note that the problem was not here with Keycloak 24.0.1.

      Version

      24.0.2

      Regression

      [X] The issue is a regression

      Expected behavior

      The user is attribute multi select is displayed with the values of the multiselect, in this example "on" and "off" for instance.

      Actual behavior

      The rendering of the HTML is broken:

      • the label of the first value is "n" instead of "on".
      • the label is missing for the second attribute.
        ```
        <div class="pf-c-form__group-control">
        <div class="pf-c-radio">
            <input id="on" data-testid="on" class="pf-c-radio__input" type="radio" aria-invalid="false"
                   data-ouia-component-type="PF4/Radio" data-ouia-safe="true"
                   data-ouia-component-id="OUIA-Generated-Radio-1" value="on" data-form-type="other">
            <label class="pf-c-radio__label" for="on">n</label>
        </div>
        <div class="pf-c-radio pf-m-standalone">
            <input id="off" data-testid="off" class="pf-c-radio__input" type="radio" aria-invalid="false"
                   data-ouia-component-type="PF4/Radio" data-ouia-safe="true"
                   data-ouia-component-id="OUIA-Generated-Radio-2" value="off" checked="">
        </div>
        

        </div>

        h3. How to Reproduce?
        
        Create a user attribute of type "select-radiobuttons" with "on" and "off" as valid values.
        
        Here is a configuration of the concerned attribute, here named "optin".
        ![image|https://github.com/keycloak/keycloak/assets/1038299/da34b85d-65c7-49ab-87c6-a5ed9faa0253]
        
        Here is the complete save of the user profile json config.
        
        { "attributes": [ {code}

        {
        "name": "username",
        "displayName": "${username}",
        "validations": {
        "length":

        { "min": 3, "max": 255 }

        ,
        "username-prohibited-characters": {},
        "up-username-not-idn-homograph": {}
        },
        "permissions":

        { "view": [ "admin", "user" ], "edit": [ "admin", "user" ] }

        ,
        "multivalued": false
        },
        {
        "name": "email",
        "displayName": "${email}",
        "validations": {
        "email": {},
        "length":

        { "max": 255 }

        },
        "required":

        { "roles": [ "user" ] }

        ,
        "permissions":

        { "view": [ "admin", "user" ], "edit": [ "admin", "user" ] }

        ,
        "multivalued": false
        },
        {
        "name": "firstName",
        "displayName": "${firstName}",
        "validations": {
        "length":

        { "max": 255 }

        ,
        "person-name-prohibited-characters": {}
        },
        "required":

        { "roles": [ "user" ] }

        ,
        "permissions":

        { "view": [ "admin", "user" ], "edit": [ "admin", "user" ] }

        ,
        "multivalued": false
        },
        {
        "name": "lastName",
        "displayName": "${lastName}",
        "validations": {
        "length":

        { "max": 255 }

        ,
        "person-name-prohibited-characters": {}
        },
        "required":

        { "roles": [ "user" ] }

        ,
        "permissions":

        { "view": [ "admin", "user" ], "edit": [ "admin", "user" ] }

        ,
        "multivalued": false
        },
        {
        "name": "optin",
        "displayName": "Product",
        "validations":

        Unknown macro: { "options"}

        ,
        "annotations":

        { "inputHelperTextAfter": "Test text", "inputType": "select-radiobuttons" }

        ,
        "required":

        { "roles": [ "user" ] }

        ,
        "permissions":

        { "view": [ "admin", "user" ], "edit": [ "admin", "user" ] }

        ,
        "multivalued": false
        }

          ],
          "groups": [
        
        { "name": "user-metadata", "displayHeader": "User metadata", "displayDescription": "Attributes, which refer to user metadata" } {code}

        ],
        "unmanagedAttributePolicy": "ENABLED"
        }
        ```

      Anything else?

      No response

              Unassigned Unassigned
              pvlha Pavel Vlha
              Keycloak Core IAM
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: