Skip to content

Commit

Permalink
fix: 402 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
yooooonshine committed Aug 12, 2024
1 parent 2ed7840 commit d504e46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ public enum UserErrorCode implements ErrorCode {

//4xx
UNAUTHORIZED(HttpStatus.UNAUTHORIZED, "인증에 실패하였습니다."),
INVALID_ACCESS_TOKEN(HttpStatus.PAYMENT_REQUIRED, "Access Token이 유효하지 않습니다."),
INVALID_ACCESS_TOKEN(HttpStatus.UNAUTHORIZED, "Access Token이 유효하지 않습니다."),
INVALID_REFRESH_TOKEN(HttpStatus.UNAUTHORIZED, "Refresh Token이 유효하지 않습니다."),
REISSUE_ACCESS_TOKEN(HttpStatus.PAYMENT_REQUIRED, "Access Token을 재발급해야합니다."),
ACCESS_DENIED(HttpStatus.FORBIDDEN, "접근 권한이 없습니다."),

MEMBER_NOT_FOUND(HttpStatus.NOT_FOUND, "존재하지 않는 회원입니다."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
Expand All @@ -21,7 +20,6 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import middle_point_search.backend.common.exception.CustomException;
import middle_point_search.backend.common.exception.errorCode.UserErrorCode;
import middle_point_search.backend.common.properties.SecurityProperties;
import middle_point_search.backend.common.security.jwt.provider.JwtTokenProvider;
import middle_point_search.backend.domains.member.repository.MemberRepository;
Expand Down Expand Up @@ -102,7 +100,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
filterChain.doFilter(request, response);
} else if (accessToken != null && !jwtTokenProvider.isTokenValid(accessToken)) {
log.info("access토큰 인증 실패");
throw new CustomException(INVALID_ACCESS_TOKEN);
throw new CustomException(REISSUE_ACCESS_TOKEN);
} else if (refreshToken != null && jwtTokenProvider.isTokenValid(refreshToken)) {
log.info("refresh토큰 인증 성공");
jwtTokenProvider.checkRefreshTokenAndReIssueAccessAndRefreshToken(response, refreshToken);
Expand Down

0 comments on commit d504e46

Please sign in to comment.