Skip to content

Commit

Permalink
Fix : 토큰 예외처리 수정 (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
Astin01 authored Sep 22, 2024
1 parent 9118be4 commit 0fdd62f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import solitour_backend.solitour.auth.config.AuthenticationPrincipal;
import solitour_backend.solitour.auth.exception.TokenNotExistsException;
import solitour_backend.solitour.auth.exception.TokenNotValidException;
import solitour_backend.solitour.auth.support.CookieExtractor;
import solitour_backend.solitour.auth.support.JwtTokenProvider;
Expand Down Expand Up @@ -212,7 +213,7 @@ private Long findUser(HttpServletRequest request) {
}

if (jwtTokenProvider.validateTokenNotUsable(token)) {
throw new TokenNotValidException("토큰이 유효하지 않습니다.");
throw new TokenNotExistsException("토큰이 존재하지 않습니다.");
}

return jwtTokenProvider.getPayload(token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.springframework.web.bind.annotation.*;
import solitour_backend.solitour.auth.config.Authenticated;
import solitour_backend.solitour.auth.config.AuthenticationPrincipal;
import solitour_backend.solitour.auth.exception.TokenNotExistsException;
import solitour_backend.solitour.auth.exception.TokenNotValidException;
import solitour_backend.solitour.auth.support.CookieExtractor;
import solitour_backend.solitour.auth.support.JwtTokenProvider;
Expand Down Expand Up @@ -165,7 +166,7 @@ private Long findUser(HttpServletRequest request) {
}

if (jwtTokenProvider.validateTokenNotUsable(token)) {
throw new TokenNotValidException("토큰이 유효하지 않습니다.");
throw new TokenNotExistsException("토큰이 존재하지 않습니다.");
}

return jwtTokenProvider.getPayload(token);
Expand Down

0 comments on commit 0fdd62f

Please sign in to comment.