78.1 Update user (#9)

This commit is contained in:
Art
2021-09-09 22:34:38 +03:00
parent beaab1d298
commit c1f3d53793
2 changed files with 201 additions and 0 deletions

View File

@ -63,6 +63,12 @@ public class UserResource {
return userService.addNewUser(userDto);
}
@PutMapping("{currentUsername}")
public User updateUser(@PathVariable String currentUsername, @Valid UserDto userDto) {
log.debug("User DTO: {}", userDto);
return userService.updateUser(currentUsername, userDto);
}
private void authenticate(String username, String password) {
Authentication auth = new UsernamePasswordAuthenticationToken(username, password);
authenticationManager.authenticate(auth);