Skip to content

Commit

Permalink
Add handling of alias users in ScimUserBootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianhoelzl-sap committed Aug 23, 2024
1 parent 7aa286f commit 4e4d820
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,18 @@ private void updateUser(ScimUser existingUser, UaaUser updatedUser, boolean upda

final ScimUser newScimUser = convertToScimUser(updatedUser);
newScimUser.setVersion(existingUser.getVersion());
scimUserProvisioning.update(id, newScimUser, IdentityZoneHolder.get().getId());
newScimUser.setZoneId(existingUser.getZoneId());

/* the user in the event won't have the alias properties set, we must therefore propagate them from the existing
* user, if present */
if (hasText(existingUser.getAliasId()) && hasText(existingUser.getAliasZid())) {
newScimUser.setAliasId(existingUser.getAliasId());
newScimUser.setAliasZid(existingUser.getAliasZid());
}

// this will also handle the update of the alias user, if necessary
scimUserService.updateUser(id, newScimUser);

if (OriginKeys.UAA.equals(newScimUser.getOrigin()) && hasText(updatedUser.getPassword())) { //password is not relevant for non UAA users
scimUserProvisioning.changePassword(id, null, updatedUser.getPassword(), IdentityZoneHolder.get().getId());
}
Expand Down

0 comments on commit 4e4d820

Please sign in to comment.