Skip to content

Commit

Permalink
feat: update keycloak user without credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
ferruhcihan committed Sep 27, 2024
1 parent 9dae385 commit b720b98
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/operator/keycloak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit b720b98

Please sign in to comment.