To update an User you need to create an specific User. For more details how an update User has to look please see at the SCIM specification.
The classs UpdateUser was created to make this process more easy and secure.
You can create an UpdateUser with his builder like:
UpdateUser updateUser = new UpdateUser.Builder()
//...
.build();
If you are using the connector4java you can directly use this UpdateUser object.
osiamConnector.updateUser(user_id, updateUser, accessToken);
In case you want to use the scim user directly you can call
User user = updateUser.getScimConformUpdateUser();
The following actions can be done with single attributes
updateUserBuilder.updateActive(true)
.updateNickName("new Nickname")
.updateUserName("newUserName")
.updatePassword("newPassword");
updateUserBuilder.deleteNickName()
.deleteTitle();
Main attribute like userName, active or the password can't be deleted.
The following actions can be done with MultiValueAttribtues
Email email = getNewEmail();
Address address = getNewAddress();
updateUserBuilder.addEmail(email)
.addAddress(address);
updateUserBuilder.deleteEmails()
.deleteAddresses();
Email email = getDeleteEmail();
Address address = getDeleteAddress();
updateUserBuilder.deleteEmail(email)
.deleteAddress(address);
Email oldEmail = getOldEmail();
Email newEmail = getNewEmail();
Address oldAddress = getOldAddress();
Address newAddress = getNEwAddress();
updateUserBuilder.updateEmail(oldEmail, newEmail)
.updateAddress(oldAddress, newAddress);
The following actions can be done with Extension
updateUserBuilder.deleteExtension(<urn>)
updateUserBuilder.deleteExtensionField(<urn>, <fieldName>)
Extension extension = new Extension.Builder("urn")
.setField("onFieldOfMany", "newValue")
.build();
updateUserBuilder.updateExtension(extension);