|
|
|
@ -4,10 +4,10 @@ import java.time.Instant;
|
|
|
|
import java.util.Optional;
|
|
|
|
import java.util.Optional;
|
|
|
|
import java.util.UUID;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import jakarta.transaction.Transactional;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import kr.re.etri.autoflow.exception.TokenRefreshException;
|
|
|
|
import kr.re.etri.autoflow.exception.TokenRefreshException;
|
|
|
|
import kr.re.etri.autoflow.models.RefreshToken;
|
|
|
|
import kr.re.etri.autoflow.models.RefreshToken;
|
|
|
|
@ -16,7 +16,7 @@ import kr.re.etri.autoflow.repository.UserRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class RefreshTokenService {
|
|
|
|
public class RefreshTokenService {
|
|
|
|
@Value("${bezkoder.app.jwtRefreshExpirationMs}")
|
|
|
|
@Value("${cuuva.app.jwtRefreshExpirationMs}")
|
|
|
|
private Long refreshTokenDurationMs;
|
|
|
|
private Long refreshTokenDurationMs;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
@ -29,6 +29,7 @@ public class RefreshTokenService {
|
|
|
|
return refreshTokenRepository.findByToken(token);
|
|
|
|
return refreshTokenRepository.findByToken(token);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
public RefreshToken createRefreshToken(Long userId) {
|
|
|
|
public RefreshToken createRefreshToken(Long userId) {
|
|
|
|
RefreshToken refreshToken = new RefreshToken();
|
|
|
|
RefreshToken refreshToken = new RefreshToken();
|
|
|
|
|
|
|
|
|
|
|
|
@ -50,7 +51,7 @@ public class RefreshTokenService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public int deleteByUserId(Long userId) {
|
|
|
|
public void deleteByUserId(Long userId) {
|
|
|
|
return refreshTokenRepository.deleteByUser(userRepository.findById(userId).get());
|
|
|
|
refreshTokenRepository.deleteByUserId(userId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|