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

[Fix]: 유저 refresh token 발급 로직 수정 #115

Merged
merged 2 commits into from
Mar 11, 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 @@ -6,16 +6,12 @@
import io.sobok.SobokSobok.auth.ui.dto.JwtTokenResponse;
import io.sobok.SobokSobok.exception.ErrorCode;
import io.sobok.SobokSobok.exception.model.NotFoundException;
import io.sobok.SobokSobok.friend.infrastructure.FriendQueryRepository;
import io.sobok.SobokSobok.friend.infrastructure.FriendRepository;
import io.sobok.SobokSobok.pill.domain.Pill;
import io.sobok.SobokSobok.pill.infrastructure.PillQueryRepository;
import io.sobok.SobokSobok.pill.infrastructure.PillRepository;
import io.sobok.SobokSobok.pill.infrastructure.PillScheduleQueryRepository;
import io.sobok.SobokSobok.pill.infrastructure.PillScheduleRepository;
import io.sobok.SobokSobok.security.jwt.Jwt;
import io.sobok.SobokSobok.security.jwt.JwtProvider;
import io.sobok.SobokSobok.sticker.infrastructure.LikeScheduleQueryRepository;
import io.sobok.SobokSobok.sticker.infrastructure.LikeScheduleRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.RedisTemplate;
Expand Down Expand Up @@ -56,8 +52,10 @@ public void logout(Long userId) {
public JwtTokenResponse refresh(String token) {

Authentication authentication = jwtProvider.getAuthentication(token);
String socialId = authentication.getName();

String username = authentication.getName();
User user = userRepository.findByUsername(username)
.orElseThrow(() -> new NotFoundException(ErrorCode.UNREGISTERED_USER));
String socialId = user.getSocialInfo().getSocialId();
if (socialId == null) {
throw new NotFoundException(ErrorCode.UNREGISTERED_TOKEN);
}
Expand Down
Loading