adorsys / keycloak-config-cli

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

Crdential with userLabel "initial" leads to unnecessary UPDATE USER #882

Closed srose closed 9 months ago

srose commented 1 year ago

Current Behavior

If a user has a credential with userLabel "initial" as the only credential, then this will result in unnecessary updates to the user on re-execution.

Background: Once the user has been created in keycloak, the existing user is retrieved for comparison. Before the comparison, the credential with userLabel "initial" is removed. Thereby the user object from the local configuration has an empty list as credential. The Keycloak API responds with null. The comparison therefore detects a difference and an update is performed again.

Expected Behavior

Somehow recognise null and empty list as "same".

Steps To Reproduce

1. Definition of a user in yaml/json, containing a credential with userLabel "initial"
2. Run Import
3. Change the file, but not the user definition to make the import logic start again
4. Run Import
5. See UPDATE USER Event for the user not changed.

Environment

Anything else?

gzm0 commented 11 months ago

Dupe of #819?