Source:
private ResponseEntity<String> changePassword(String userId, String authorization, String oneTimePassword, String newPassword) throws IOException { if (Strings.isNullOrEmpty(oneTimePassword)) { String message = "The submitted one time password is invalid!"; LOGGER.warn(message); return RegistrationHelper.createErrorResponseEntity(message, HttpStatus.FORBIDDEN); } User updatedUser; try { AccessToken accessToken = new AccessToken.Builder(RegistrationHelper.extractAccessToken(authorization)) .build(); User user; if(Strings.isNullOrEmpty(userId)) { user = connectorBuilder.createConnector().getCurrentUser(accessToken); } else { user = connectorBuilder.createConnector().getUser(userId, accessToken); } Extension extension = user.getExtension(internalScimExtensionUrn); String savedOneTimePassword; try { savedOneTimePassword = extension.getField(this.oneTimePassword, ExtensionFieldType.STRING); } catch(NoSuchElementException e) { String message = e.getMessage() + " - This user has no onetime password to reset his password"; LOGGER.warn(message); return RegistrationHelper.createErrorResponseEntity(message, HttpStatus.FORBIDDEN); } if (!savedOneTimePassword.equals(oneTimePassword)) { String message = "The submitted one time password is invalid!"; LOGGER.warn(message); return RegistrationHelper.createErrorResponseEntity(message, HttpStatus.FORBIDDEN); } UpdateUser updateUser = getPreparedUserToChangePassword(extension, newPassword); updatedUser = connectorBuilder.createConnector().updateUser(user.getId(), updateUser, accessToken); } catch (OsiamRequestException e) { LOGGER.warn(e.getMessage()); return RegistrationHelper.createErrorResponseEntity(e.getMessage(), HttpStatus.valueOf(e.getHttpStatusCode())); } catch (OsiamClientException e) { LOGGER.error(e.getMessage()); return RegistrationHelper.createErrorResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<>(mapper.writeValueAsString(updatedUser), HttpStatus.OK); }

Target:
private ResponseEntity<String> changePassword(String userId, String authorization, String oneTimePassword, String newPassword) throws IOException { if (Strings.isNullOrEmpty(oneTimePassword)) { String message = "The submitted one time password is invalid!"; LOGGER.warn(message); return SelfAdministrationHelper.createErrorResponseEntity(message, HttpStatus.FORBIDDEN); } User updatedUser; try { AccessToken accessToken = new AccessToken.Builder(SelfAdministrationHelper.extractAccessToken(authorization)) .build(); User user; if(Strings.isNullOrEmpty(userId)) { user = connectorBuilder.createConnector().getCurrentUser(accessToken); } else { user = connectorBuilder.createConnector().getUser(userId, accessToken); } Extension extension = user.getExtension(internalScimExtensionUrn); String savedOneTimePassword; try { savedOneTimePassword = extension.getField(this.oneTimePassword, ExtensionFieldType.STRING); } catch(NoSuchElementException e) { String message = e.getMessage() + " - This user has no onetime password to reset their password"; LOGGER.warn(message); return SelfAdministrationHelper.createErrorResponseEntity(message, HttpStatus.FORBIDDEN); } if (!savedOneTimePassword.equals(oneTimePassword)) { String message = "The submitted one time password is invalid!"; LOGGER.warn(message); return SelfAdministrationHelper.createErrorResponseEntity(message, HttpStatus.FORBIDDEN); } UpdateUser updateUser = getPreparedUserToChangePassword(extension, newPassword); updatedUser = connectorBuilder.createConnector().updateUser(user.getId(), updateUser, accessToken); } catch (OsiamRequestException e) { LOGGER.warn(e.getMessage()); return SelfAdministrationHelper.createErrorResponseEntity(e.getMessage(), HttpStatus.valueOf(e.getHttpStatusCode())); } catch (OsiamClientException e) { LOGGER.error(e.getMessage()); return SelfAdministrationHelper.createErrorResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<>(mapper.writeValueAsString(updatedUser), HttpStatus.OK); }