55import bumblebee .xchangepass .domain .card .dto .response .DetailedCardInfoResponse ;
66import bumblebee .xchangepass .domain .card .service .CardService ;
77import bumblebee .xchangepass .global .error .ErrorCode ;
8- import bumblebee .xchangepass .global .security .jwt .JwtUtil ;
8+ import bumblebee .xchangepass .global .security .jwt .CustomUserDetails ;
99import io .swagger .v3 .oas .annotations .Operation ;
1010import io .swagger .v3 .oas .annotations .media .Content ;
1111import io .swagger .v3 .oas .annotations .media .ExampleObject ;
1717import lombok .RequiredArgsConstructor ;
1818import org .springframework .http .HttpStatus ;
1919import org .springframework .security .core .Authentication ;
20+ import org .springframework .security .core .annotation .AuthenticationPrincipal ;
2021import org .springframework .web .bind .annotation .*;
2122
2223import java .util .List ;
@@ -40,8 +41,8 @@ public class CardController {
4041 })
4142 @ ResponseStatus (HttpStatus .CREATED )
4243 @ PostMapping ("/physical" )
43- public void generatePhysicalCard (Authentication authentication ) {
44- cardService .generatePhysicalCard (JwtUtil . getLoginId ( authentication ));
44+ public void generatePhysicalCard (@ AuthenticationPrincipal CustomUserDetails user ) {
45+ cardService .generatePhysicalCard (user . getUserId ( ));
4546 }
4647
4748 @ Operation (summary = "카드 상태 변경" , description = "현재 로그인한 사용자의 카드 상태를 변경합니다." )
@@ -56,9 +57,9 @@ public void generatePhysicalCard(Authentication authentication) {
5657 })
5758 @ ResponseStatus (HttpStatus .NO_CONTENT )
5859 @ PutMapping ("/status" )
59- public void changeCardStatus (Authentication authentication ,
60+ public void changeCardStatus (@ AuthenticationPrincipal CustomUserDetails user ,
6061 @ RequestBody @ Valid ChangeCardStatusRequest request ) {
61- cardService .changeCardStatus (JwtUtil . getLoginId ( authentication ), request );
62+ cardService .changeCardStatus (user . getUserId ( ), request );
6263 }
6364
6465 @ Operation (summary = "보유 카드 목록 조회" , description = "현재 로그인한 사용자의 보유 카드 목록을 조회합니다." )
@@ -73,8 +74,8 @@ public void changeCardStatus(Authentication authentication,
7374 })
7475 @ ResponseStatus (HttpStatus .OK )
7576 @ GetMapping
76- public List <BasicCardInfoResponse > getBasicCardInfo (Authentication authentication ) {
77- return cardService .getBasicCardInfo (JwtUtil . getLoginId ( authentication ));
77+ public List <BasicCardInfoResponse > getBasicCardInfo (@ AuthenticationPrincipal CustomUserDetails user ) {
78+ return cardService .getBasicCardInfo (user . getUserId ( ));
7879 }
7980
8081 @ Operation (summary = "카드 상세 정보 조회" , description = "특정 카드의 상세 정보를 조회합니다." )
0 commit comments