인증 방법 업뎃

왕감자·2025년 2월 21일

2025 내일배움캠프

목록 보기
30/39

private Member getAuthenticatedMember() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String username = authentication.getName();
return memberRepository.findByUsernameAndDeletedAtIsNull(username)
.orElseThrow(() -> new CustomException(MemberErrorCode.MEMBER_NOT_FOUND));
}

@GetMapping
public ResponseEntity getMemberInfo(@AuthenticationPrincipal CustomPrincipal principal) {
return ResponseEntity.ok(memberService.getMemberInfo(principal.getId()));
}

0개의 댓글