From b720b98932382c0f36581fee911272133c911890 Mon Sep 17 00:00:00 2001 From: Ferruh Cihan <63190600+ferruhcihan@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:37:15 +0200 Subject: [PATCH] feat: update keycloak user without credentials --- src/operator/keycloak.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/operator/keycloak.ts b/src/operator/keycloak.ts index be9e742..cb710b8 100644 --- a/src/operator/keycloak.ts +++ b/src/operator/keycloak.ts @@ -23,7 +23,7 @@ import { UserRepresentation, UsersApi, } from '@linode/keycloak-client-node' -import { forEach } from 'lodash' +import { forEach, omit } from 'lodash' import { custom, Issuer, TokenSet } from 'openid-client' import { keycloakRealm } from '../tasks/keycloak/config' import { @@ -721,8 +721,9 @@ async function createUpdateUser(api: any, user: any) { try { if (existingUser) { console.debug(`User with email ${email} already exists, updating user`) + const userConfWithoutCredentials = omit(userConf, ['credentials']) await doApiCall(errors, `Updating user ${username}`, async () => - api.users.realmUsersIdPut(keycloakRealm, existingUser.id as string, userConf), + api.users.realmUsersIdPut(keycloakRealm, existingUser.id as string, userConfWithoutCredentials), ) } else { await doApiCall(errors, `Creating user ${username}`, () => api.users.realmUsersPost(keycloakRealm, userConf))