public void setPassword(String password) { user.setPassword(password); this.password = password; } public boolean isUser() {
private void readUsers(final InputStream usersInputStream) throws IdentityServiceInitException { final Properties usersProps = new Properties(); try { usersProps.load(usersInputStream); } catch (final IOException e) { throw new IdentityServiceInitException(e); } for (final Entry<Object, Object> entry : usersProps.entrySet()) { final User user = new UserEntity((String) entry.getKey()); user.setPassword((String) entry.getValue()); this.users.put((String) entry.getKey(), user); } }
@ApiOperation(value = "Update a user", tags = {"Users"}, notes="All request values are optional. " + "For example, you can only include the firstName attribute in the request body JSON-object, only updating the firstName of the user, leaving all other fields unaffected. " + "When an attribute is explicitly included and is set to null, the user-value will be updated to null. " + "Example: {\"firstName\" : null} will clear the firstName of the user).") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was updated."), @ApiResponse(code = 404, message = "Indicates the requested user was not found."), @ApiResponse(code = 409, message = "Indicates the requested user was updated simultaneously.") }) @RequestMapping(value = "/identity/users/{userId}", method = RequestMethod.PUT, produces = "application/json") public UserResponse updateUser(@ApiParam(name = "userId") @PathVariable String userId, @RequestBody UserRequest userRequest, HttpServletRequest request) { User user = getUserFromRequest(userId); if (userRequest.isEmailChanged()) { user.setEmail(userRequest.getEmail()); } if (userRequest.isFirstNameChanged()) { user.setFirstName(userRequest.getFirstName()); } if (userRequest.isLastNameChanged()) { user.setLastName(userRequest.getLastName()); } if (userRequest.isPasswordChanged()) { user.setPassword(userRequest.getPassword()); } identityService.saveUser(user); return restResponseFactory.createUserResponse(user, false); }
public void afterPropertiesSet() throws Exception { Group group = identityService.newGroup("user"); group.setName("users"); group.setType("security-role"); identityService.saveGroup(group); User admin = identityService.newUser("admin"); admin.setPassword("admin"); identityService.saveUser(admin); } };
user.setFirstName(firstName); user.setLastName(lastName); user.setPassword(password); user.setEmail(email); identityService.saveUser(user);
user.setFirstName(firstName); user.setLastName(lastName); user.setPassword(password); user.setEmail(email); identityService.saveUser(user);
@ApiOperation(value = "Create a user", tags = {"Users"}) @ApiResponses(value = { @ApiResponse(code = 201, message = "Indicates the user was created."), @ApiResponse(code = 400, message = "Indicates the id of the user was missing.") }) @RequestMapping(value = "/identity/users", method = RequestMethod.POST, produces = "application/json") public UserResponse createUser(@RequestBody UserRequest userRequest, HttpServletRequest request, HttpServletResponse response) { if (userRequest.getId() == null) { throw new ActivitiIllegalArgumentException("Id cannot be null."); } // Check if a user with the given ID already exists so we return a // CONFLICT if (identityService.createUserQuery().userId(userRequest.getId()).count() > 0) { throw new ActivitiConflictException("A user with id '" + userRequest.getId() + "' already exists."); } User created = identityService.newUser(userRequest.getId()); created.setEmail(userRequest.getEmail()); created.setFirstName(userRequest.getFirstName()); created.setLastName(userRequest.getLastName()); created.setPassword(userRequest.getPassword()); identityService.saveUser(created); response.setStatus(HttpStatus.CREATED.value()); return restResponseFactory.createUserResponse(created, true); }
public void buttonClick(ClickEvent event) { String originalFirstName = user.getFirstName(); String originalLastName = user.getLastName(); // Change data user.setFirstName(firstNameField.getValue().toString()); user.setLastName(lastNameField.getValue().toString()); user.setEmail(emailField.getValue().toString()); if (passwordField.getValue() != null && !"".equals(passwordField.getValue().toString())) { user.setPassword(passwordField.getValue().toString()); } identityService.saveUser(user); // Refresh detail panel editingDetails = false; userDetailsLayout.removeAllComponents(); populateUserDetails(); // Refresh task list (only if name was changed) if (nameChanged(originalFirstName, originalLastName)) { userPage.notifyUserChanged(user.getId()); } } });
protected User createUser() { User user = identityService.newUser(form.getField("id").getValue().toString()); user.setPassword(form.getField("password").getValue().toString()); if (form.getField("firstName").getValue() != null) { user.setFirstName(form.getField("firstName").getValue().toString()); } if (form.getField("lastName").getValue() != null) { user.setLastName(form.getField("lastName").getValue().toString()); } if (form.getField("email").getValue() != null) { user.setEmail(form.getField("email").getValue().toString()); } identityService.saveUser(user); return user; }
protected void handlePasswordChange() { if (passwordField1.getValue() == null || "".equals(passwordField1.getValue().toString()) || passwordField2.getValue() == null || "".equals(passwordField2.getValue().toString())) { errorLabel.setValue(i18nManager.getMessage(Messages.PASSWORD_CHANGE_INPUT_REQUIRED)); } else if (!passwordField1.getValue().equals(passwordField2.getValue())){ errorLabel.setValue(i18nManager.getMessage(Messages.PASSWORD_CHANGE_INPUT_MATCH)); } else { String password = passwordField1.getValue().toString(); // Change data User user = identityService.createUserQuery().userId(currentUser.getId()).singleResult(); user.setPassword(password); identityService.saveUser(user); // Refresh logged in user session data ExplorerApp.get().setUser(ExplorerApp.get().getLoginHandler().authenticate( user.getId(), user.getPassword())); // Close popup close(); // Show notification ExplorerApp.get().getNotificationManager().showInformationNotification(Messages.PASSWORD_CHANGED_NOTIFICATION); } }
activitiUser.setPassword(StringUtils.EMPTY); activitiUser.setEmail(userPo.getEmail());