@PreAuthorize("hasRole('" + StandardEntitlement.MUST_CHANGE_PASSWORD + "')") public ProvisioningResult<UserTO> mustChangePassword(final String password, final boolean nullPriorityAsync) { UserPatch userPatch = new UserPatch(); userPatch.setPassword(new PasswordPatch.Builder().value(password).build()); userPatch.setMustChangePassword(new BooleanReplacePatchItem.Builder().value(false).build()); return selfUpdate(userPatch, nullPriorityAsync); }
@PreAuthorize("hasRole('" + StandardEntitlement.USER_UPDATE + "')") @Override public ProvisioningResult<UserTO> assign( final String key, final Collection<String> resources, final boolean changepwd, final String password, final boolean nullPriorityAsync) { // security checks UserTO user = binder.getUserTO(key); Set<String> effectiveRealms = RealmUtils.getEffective( AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE), user.getRealm()); securityChecks(effectiveRealms, user.getRealm(), user.getKey()); UserPatch patch = new UserPatch(); patch.setKey(key); patch.getResources().addAll(resources.stream().map(resource -> new StringPatchItem.Builder().operation(PatchOperation.ADD_REPLACE).value(resource).build()). collect(Collectors.toList())); if (changepwd) { patch.setPassword(new PasswordPatch.Builder(). value(password).onSyncope(false).resources(resources).build()); } return update(patch, nullPriorityAsync); }
@Override public List<PropagationStatus> provision( final String key, final boolean changePwd, final String password, final Collection<String> resources, final boolean nullPriorityAsync) { UserPatch userPatch = new UserPatch(); userPatch.setKey(key); userPatch.getResources().addAll(resources.stream().map(resource -> new StringPatchItem.Builder().operation(PatchOperation.ADD_REPLACE).value(resource).build()). collect(Collectors.toSet())); if (changePwd) { PasswordPatch passwordPatch = new PasswordPatch(); passwordPatch.setOnSyncope(false); passwordPatch.getResources().addAll(resources); passwordPatch.setValue(password); userPatch.setPassword(passwordPatch); } PropagationByResource propByRes = new PropagationByResource(); propByRes.addAll(ResourceOperation.UPDATE, resources); WorkflowResult<Pair<UserPatch, Boolean>> wfResult = new WorkflowResult<>( ImmutablePair.of(userPatch, (Boolean) null), propByRes, "update"); List<PropagationTaskInfo> taskInfos = propagationManager.getUserUpdateTasks(wfResult, changePwd, null); PropagationReporter propagationReporter = taskExecutor.execute(taskInfos, nullPriorityAsync); return propagationReporter.getStatuses(); }
&& (original.getPassword() == null || !original.getPassword().equals(updated.getPassword()))) { result.setPassword(new PasswordPatch.Builder(). value(updated.getPassword()). resources(updated.getResources()).build());
userPatch.setPassword( new PasswordPatch.Builder().onSyncope(true).value(password).resources(resources).build());
userPatch.setPassword(new PasswordPatch());