Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#580 [feat] 리프레시 토큰 만료시 500 에러 아닌 에러 타도록 수정 #582

Merged
merged 2 commits into from
Nov 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading