Skip to content

Commit

Permalink
Chosenname is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Apr 5, 2024
1 parent d76dca4 commit 36fdec4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,13 @@ public ResponseEntity<StatusResponse> createEduIDAccount(@Valid @RequestBody Cre
return ResponseEntity.status(HttpStatus.CREATED).body(new StatusResponse(HttpStatus.CREATED.value()));
}

@Operation(summary = "Change names", description = "Update the givenName and / or familyName of the User")
@Operation(summary = "Change names", description = "Update the givenName, chosenName and / or the familyName of the User")
@PutMapping("/sp/update")
public ResponseEntity<UserResponse> updateUserProfile(Authentication authentication, @Valid @RequestBody UpdateUserNameRequest deltaUser) {
User user = userFromAuthentication(authentication);

user.setChosenName(deltaUser.getChosenName());
if (StringUtils.hasText(deltaUser.getChosenName())) {
user.setChosenName(deltaUser.getChosenName());
}
user.setGivenName(deltaUser.getGivenName());
user.setFamilyName(deltaUser.getFamilyName());
user.validate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
@Getter
public class UpdateUserNameRequest implements Serializable {

@NotBlank
private String chosenName;

@NotBlank
Expand Down

0 comments on commit 36fdec4

Please sign in to comment.