[로그아웃 기능 구현현]

This commit is contained in:
2025-08-26 10:17:07 +09:00
parent e7105215b8
commit b5d6d213f3

View File

@@ -21,6 +21,8 @@ import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import com.bio.bio_backend.global.constants.ApiResponseCode;
import com.bio.bio_backend.global.annotation.LogExecution;
import com.bio.bio_backend.global.utils.SecurityUtils;
@Tag(name = "Member", description = "회원 관련 API")
@RestController
@@ -55,12 +57,12 @@ public class MemberController {
@ApiResponse(responseCode = "401", description = "인증 실패", content = @Content(schema = @Schema(implementation = ApiResponseDto.class)))
})
@PostMapping("/logout")
public ResponseEntity<ApiResponseDto<Void>> logout(@RequestHeader("Authorization") String authorization) {
public ResponseEntity<ApiResponseDto<Void>> logout() {
try {
// Authorization 헤더에서 토큰 추출
String token = authorization.replace("Bearer ", "");
// Refresh Token 삭제 (실제로는 JWT 블랙리스트나 DB에서 삭제)
// memberService.deleteRefreshToken(userId);
String userId = SecurityUtils.getCurrentUserId();
memberService.deleteRefreshToken(userId);
log.info("사용자 로그아웃 완료: {}", userId);
return ResponseEntity.ok(ApiResponseDto.success(ApiResponseCode.COMMON_SUCCESS));
} catch (Exception e) {