adorsys / keycloak-config-cli

Import YAML/JSON-formatted configuration files into Keycloak - Configuration as Code for Keycloak.
Apache License 2.0
703 stars 132 forks source link

Can't set unmanagedAttributePolicy in userProfile #1016

Open VictorGFM opened 1 month ago

VictorGFM commented 1 month ago

Current Behavior

When trying to add unmanagedAttributePolicy to the userProfile configuration (see config example below), the keycloak-config-cli throws an error. Config:

realm: realm-test
displayName: "Realm Test"
enabled: true
userProfile:
  - name: username
    displayName: "${username}"
    validations:
      length:
        min: 3
        max: 255
      username-prohibited-characters: { }
  unmanagedAttributePolicy: "ENABLED"

Error:

2024-05-08 22:33:45.306 ERROR 408 --- [           main] d.a.k.config.KeycloakConfigRunner        : Unable to parse file 'file:/opt/keycloak/data/import/realm.yaml': Cannot deserialize value of type `java.util.ArrayList<java.util.Map<java.lang.String,java.lang.Object>>` from String value (token `JsonToken.VALUE_STRING`)
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: de.adorsys.keycloak.config.model.RealmImport["userProfile"]->java.util.LinkedHashMap["unmanagedAttributePolicy"])

Expected Behavior

The keycloak-config-cli should be able to configure the unmanagedAttributePolicy with the corresponding value set (e.g. ENABLED, DISABLED, ADMIN_EDIT, ETC) and no error should be thrown.

Steps To Reproduce

Call the keycloak-config-cli using a config that contains the `userProfile.unmanagedAttributePolicy`, as provided in the example above.

Environment

Anything else?

No response

antikalk commented 1 week ago

Facing the same issue.