Skip to content

Commit

Permalink
#580 [feat] 리프레시 토큰 만료시 500 에러 아닌 에러 타도록 수정
Browse files Browse the repository at this point in the history
#580 [feat] 리프레시 토큰 만료시 500 에러 아닌 에러 타도록 수정
  • Loading branch information
sohyundoh authored Nov 30, 2024
2 parents a8f9936 + 9cd12fe commit 544d14f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import com.mile.client.SocialType;
import com.mile.client.dto.UserLoginRequest;
import com.mile.common.auth.JwtTokenProvider;
import com.mile.writername.domain.MoimRole;
import com.mile.common.auth.JwtValidationType;
import com.mile.exception.message.ErrorMessage;
import com.mile.exception.model.UnauthorizedException;
import com.mile.jwt.service.TokenService;
import com.mile.moim.service.dto.response.MoimListOfUserResponse;
import com.mile.strategy.LoginStrategyManager;
Expand Down Expand Up @@ -34,6 +36,10 @@ public AccessTokenGetSuccess refreshToken(
final String refreshToken
) {
final Long userId = tokenService.findIdByRefreshToken(refreshToken);

if(jwtTokenProvider.validateToken(refreshToken).equals(JwtValidationType.VALID_JWT)) {
throw new UnauthorizedException(ErrorMessage.TOKEN_INCORRECT_ERROR);
}
final Map<Long, WriterNameInfo> role = jwtTokenProvider.getJoinedRoleFromJwt(refreshToken);

return AccessTokenGetSuccess.of(
Expand Down

0 comments on commit 544d14f

Please sign in to comment.