[ADD] SWAGGER 수정

main
bjkim 10 months ago
parent 4f8519bb2f
commit 4bda28c8b6

@ -14,4 +14,6 @@ public interface RefreshTokenRepository extends JpaRepository<RefreshToken, Long
@Modifying
int deleteByUser(User user);
void deleteByUserId(Long userId);
}

@ -23,16 +23,16 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class JwtUtils {
@Value("${bezkoder.app.jwtSecret}")
@Value("${cuuva.app.jwtSecret}")
private String jwtSecret;
@Value("${bezkoder.app.jwtExpirationMs}")
@Value("${cuuva.app.jwtExpirationMs}")
private int jwtExpirationMs;
@Value("${bezkoder.app.jwtCookieName}")
@Value("${cuuva.app.jwtCookieName}")
private String jwtCookie;
@Value("${bezkoder.app.jwtRefreshCookieName}")
@Value("${cuuva.app.jwtRefreshCookieName}")
private String jwtRefreshCookie;
public ResponseCookie generateJwtCookie(UserDetailsImpl userPrincipal) {
@ -108,8 +108,18 @@ public class JwtUtils {
.build();
}
private String getCookieValueByName(HttpServletRequest request, String name) {
Cookie cookie = WebUtils.getCookie(request, name);
return cookie != null ? cookie.getValue() : null;
}
// private String getCookieValueByName(HttpServletRequest request, String name) {
// Cookie cookie = WebUtils.getCookie(request, name);
// return cookie != null ? cookie.getValue() : null;
// }
private String getCookieValueByName(HttpServletRequest request, String name) {
Cookie cookie = WebUtils.getCookie(request, name);
if (cookie == null) {
System.out.println("Cookie with name '" + name + "' not found");
return null;
}
System.out.println("Found cookie: " + cookie.getName() + " = " + cookie.getValue());
return cookie.getValue();
}
}

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

@ -17,15 +17,13 @@ spring.jpa.defer-datasource-initialization=true
# App Properties
bezkoder.app.jwtCookieName= bezkoder-jwt
bezkoder.app.jwtRefreshCookieName= bezkoder-jwt-refresh
bezkoder.app.jwtSecret= 275511b31c520562d69802ce4a913773102563891563a24062f44b3f312ca2bd034440e81836d1b4ccf4195f43db4c81a4e489a41f1ae0967afe468c9a361f4d
#bezkoder.app.jwtExpirationMs= 86400000
#bezkoder.app.jwtRefreshExpirationMs= 86400000
cuuva.app.jwtCookieName=cuuva-jwt
cuuva.app.jwtRefreshCookieName=cuuva-jwt-refresh
cuuva.app.jwtSecret= 275511b31c520562d69802ce4a913773102563891563a24062f44b3f312ca2bd034440e81836d1b4ccf4195f43db4c81a4e489a41f1ae0967afe468c9a361f4d
## For test
bezkoder.app.jwtExpirationMs= 60000
bezkoder.app.jwtRefreshExpirationMs= 180000
cuuva.app.jwtExpirationMs= 60000
cuuva.app.jwtRefreshExpirationMs= 180000
# SQL ?? ??
spring.jpa.show-sql=true

Loading…
Cancel
Save