Skip to content

Commit

Permalink
🐛 Bug: AuthMember 어노테이션 예외 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
HyoBN committed Jan 25, 2024
1 parent e47bd7d commit bfa0e5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/main/java/cmc/peerna/apiResponse/code/ResponseStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public enum ResponseStatus implements BaseCode {
FAILED_TO_FIND_AVAILABLE_RSA(HttpStatus.UNAUTHORIZED, 4014, "Identity Token에서 유효한 값을 찾지 못했습니다"),
WRONG_IDENTITY_TOKEN(BAD_REQUEST, 4015, "Identity Token의 형태가 잘못되었습니다."),

INVALID_ACCESS_TOKEN(UNAUTHORIZED, 4016, "액세스 토큰이 없거나 유효하지 않습니다."),


WRONG_POST_TEST(BAD_REQUEST, 4101, "잘못된 POST 테스트 요청입니다."),

// Test 관련 에러
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmc.peerna.jwt.handler.annotation.resolver;

import cmc.peerna.apiResponse.code.ResponseStatus;
import cmc.peerna.apiResponse.exception.handler.JwtAuthenticationException;
import cmc.peerna.apiResponse.exception.handler.MemberException;
import cmc.peerna.converter.MemberConverter;
import cmc.peerna.domain.Member;
Expand Down Expand Up @@ -59,7 +60,7 @@ public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer m
// 토큰에서 사용자 ID (subject) 추출
String userId = jwtProvider.getAuthentication(jwt).getName();
return memberService.findById(Long.valueOf(userId));
}
return null; // 토큰이 없거나 유효하지 않은 경우
} else throw new MemberException(ResponseStatus.INVALID_ACCESS_TOKEN);
// return null; // 토큰이 없거나 유효하지 않은 경우
}
}

0 comments on commit bfa0e5c

Please sign in to comment.