@Override
public User updateUser(User user, Map<String, Boolean> requiredAttributes)
throws NotImplementedException, CharonException, BadRequestException, NotFoundException {
log.debug("Updating user: {}", user);
Map<String, String> attributesMap = SCIMClaimResolver.getClaimsMap(user);
List<Attribute> attributeList = getAttributeListFromMap(attributesMap);
try {
userStoreConnector.updateUserAttributes(user.getId(), attributeList);
if (user.getAttribute(SCIMConstants.UserSchemaConstants.PASSWORD) != null) {
char[] password = ((SimpleAttribute) (user.getAttribute(SCIMConstants.UserSchemaConstants.PASSWORD)))
.getStringValue().toCharArray();
PasswordCallback passwordCallback =
new PasswordCallback(SCIMConstants.UserSchemaConstants.PASSWORD, false);
passwordCallback.setPassword(password);
userStoreConnector.updateCredentials(user.getId(), passwordCallback);
}
return this.getUser(user.getId(), requiredAttributes);
} catch (UserStoreConnectorException e) {
log.error("Error occurred while updating user: " + user + " to user store", e);
handleUserStoreExceptionWhenUpdating(e);
}
return null;
}