From 26b9781ce3f5dc25203926821208d566702c591b Mon Sep 17 00:00:00 2001 From: wrathlion Date: Mon, 9 Sep 2024 01:59:30 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=99=84=EB=A3=8C=20=EC=8B=9C=20=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20redirect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to: #1 --- .../kaboo_auth/domain/handler/LoginSuccessHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/kaboo/kaboo_auth/domain/handler/LoginSuccessHandler.java b/src/main/java/kaboo/kaboo_auth/domain/handler/LoginSuccessHandler.java index 4bfe757..46f798b 100644 --- a/src/main/java/kaboo/kaboo_auth/domain/handler/LoginSuccessHandler.java +++ b/src/main/java/kaboo/kaboo_auth/domain/handler/LoginSuccessHandler.java @@ -2,6 +2,7 @@ import java.io.IOException; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler; import org.springframework.stereotype.Component; @@ -26,6 +27,9 @@ public class LoginSuccessHandler extends SimpleUrlAuthenticationSuccessHandler { private final int accessTokenValidTime = 10 * 60; // 유효기간 : 10분 private final int refreshTokenValidTime = 10 * 24 * 60 * 60; // 유효기간 : 10일 + @Value("${AUTH.REDIRECT_URL}") + String redirectURL; + private Cookie createCookie(String key, String value, int maxAge) { Cookie cookie = new Cookie(key, value); cookie.setMaxAge(maxAge); @@ -49,6 +53,6 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo response.addCookie(createCookie("Username", username, refreshTokenValidTime)); response.addCookie(createCookie("Authorization", accessToken, accessTokenValidTime)); response.addCookie(createCookie("RefreshToken", refreshToken, refreshTokenValidTime)); - response.sendRedirect("/"); + response.sendRedirect(redirectURL); } }