|
8 | 8 | import org.springframework.http.ResponseEntity; |
9 | 9 | import org.springframework.security.access.prepost.PreAuthorize; |
10 | 10 | import org.springframework.security.core.annotation.AuthenticationPrincipal; |
| 11 | +import org.springframework.web.bind.annotation.PatchMapping; |
11 | 12 | import org.springframework.web.bind.annotation.PostMapping; |
12 | 13 | import org.springframework.web.bind.annotation.RequestBody; |
13 | 14 | import org.springframework.web.bind.annotation.RequestHeader; |
14 | 15 | import org.springframework.web.bind.annotation.RestController; |
| 16 | +import org.websoso.WSSServer.dto.auth.AppleIdUpdateRequest; |
15 | 17 | import org.websoso.WSSServer.user.domain.User; |
16 | 18 | import org.websoso.WSSServer.dto.auth.AppleLoginRequest; |
17 | 19 | import org.websoso.WSSServer.dto.auth.AuthResponse; |
@@ -54,6 +56,21 @@ public ResponseEntity<AuthResponse> loginByApple(@Valid @RequestBody AppleLoginR |
54 | 56 | .body(appleService.getUserInfoFromApple(request)); |
55 | 57 | } |
56 | 58 |
|
| 59 | + @PatchMapping("/auth/apple/sync") |
| 60 | + public ResponseEntity<Void> updateAppleSocialId( |
| 61 | + @AuthenticationPrincipal User user, |
| 62 | + @Valid @RequestBody AppleIdUpdateRequest request |
| 63 | + ) { |
| 64 | + if (!request.authorizationCode().isBlank() && !request.idToken().isBlank()) { |
| 65 | + appleService.syncSocialId(user, request); |
| 66 | + } |
| 67 | + |
| 68 | + return ResponseEntity |
| 69 | + .status(NO_CONTENT) |
| 70 | + .build(); |
| 71 | + } |
| 72 | + |
| 73 | + |
57 | 74 | @PostMapping("/auth/logout") |
58 | 75 | @PreAuthorize("isAuthenticated()") |
59 | 76 | public ResponseEntity<Void> logout(@AuthenticationPrincipal User user, |
|
0 commit comments