fix: 관리자 게시판 연관상품 이미지 및 로컬 인증 보정

This commit is contained in:
이주일
2026-07-19 09:07:16 +09:00
parent 7564dc21e5
commit cb0157a73b
5 changed files with 44 additions and 10 deletions

View File

@@ -197,11 +197,12 @@ public class MngrLoginController {
log.debug("리프레쉬 토큰이 없는 경우 realm :: {}", realm); log.debug("리프레쉬 토큰이 없는 경우 realm :: {}", realm);
//엑세스토큰 삭제 //엑세스토큰 삭제
CookieUtils.deleteCookie("ACT","/"+realm, request, response); CookieUtils.deleteCookie("ACT","/", request, response);
CookieUtils.deleteCookie("token_expire","/"+realm, request, response); CookieUtils.deleteCookie("RFT","/" + realm + "/tokens/refresh", request, response);
CookieUtils.deleteCookie("token_expire","/", request, response);
response.sendRedirect("/"+realm); response.sendRedirect("/"+realm);
return;
} }
//리프레쉬 토큰 있을 경우(존재한다는 자체가 refresh토큰이 만료된 상태가 아님) //리프레쉬 토큰 있을 경우(존재한다는 자체가 refresh토큰이 만료된 상태가 아님)

View File

@@ -371,7 +371,9 @@ public class MngrLoggingInterceptor implements HandlerInterceptor {
String cookieValue = agentId + ":" + md5(agentId + ":" + md5(System.currentTimeMillis() + ":" + random.nextInt())).substring(5, 10); String cookieValue = agentId + ":" + md5(agentId + ":" + md5(System.currentTimeMillis() + ":" + random.nextInt())).substring(5, 10);
Cookie agentIdCookie = new Cookie("agent_id", cookieValue); Cookie agentIdCookie = new Cookie("agent_id", cookieValue);
agentIdCookie.setMaxAge(86400 * 365 * 10); // 10년 agentIdCookie.setMaxAge(86400 * 365 * 10); // 10년
agentIdCookie.setDomain(domain); if (!request.getServerName().startsWith("loc.")) {
agentIdCookie.setDomain(domain);
}
// agentIdCookie.setHttpOnly(true); // agentIdCookie.setHttpOnly(true);
agentIdCookie.setPath("/mngr"); agentIdCookie.setPath("/mngr");
// agentIdCookie.setSecure(true); // agentIdCookie.setSecure(true);

View File

@@ -44,9 +44,12 @@ public abstract class CookieUtils {
Cookie cookie = new Cookie(name, null); Cookie cookie = new Cookie(name, null);
cookie.setMaxAge(0); cookie.setMaxAge(0);
cookie.setPath(path); cookie.setPath(path);
cookie.setDomain(originHost); setCookieDomain(cookie, request, originHost);
cookie.setHttpOnly(true); cookie.setHttpOnly(true);
response.addCookie(cookie); response.addCookie(cookie);
// loc 환경에서는 이전에 상위 도메인으로 저장된 쿠키도 함께 삭제한다.
deleteLegacyDomainCookie(name, path, request, response, originHost);
} }
public static void createCookie(String name, String value, String path, int maxAge, boolean httpOnly, HttpServletRequest request, HttpServletResponse response) { public static void createCookie(String name, String value, String path, int maxAge, boolean httpOnly, HttpServletRequest request, HttpServletResponse response) {
@@ -58,10 +61,12 @@ public abstract class CookieUtils {
String originHost = UrlExtractor.getOriginalHost(host); String originHost = UrlExtractor.getOriginalHost(host);
deleteLegacyDomainCookie(name, path, request, response, originHost);
Cookie cookie = new Cookie(name, value); Cookie cookie = new Cookie(name, value);
cookie.setMaxAge(maxAge); cookie.setMaxAge(maxAge);
cookie.setPath(path); cookie.setPath(path);
cookie.setDomain(originHost); setCookieDomain(cookie, request, originHost);
cookie.setHttpOnly(httpOnly); cookie.setHttpOnly(httpOnly);
response.addCookie(cookie); response.addCookie(cookie);
} }
@@ -77,7 +82,7 @@ public abstract class CookieUtils {
Cookie cookie = new Cookie(name, value); Cookie cookie = new Cookie(name, value);
cookie.setPath(path); cookie.setPath(path);
cookie.setDomain(originHost); setCookieDomain(cookie, request, originHost);
cookie.setHttpOnly(httpOnly); cookie.setHttpOnly(httpOnly);
response.addCookie(cookie); response.addCookie(cookie);
} }
@@ -96,4 +101,30 @@ public abstract class CookieUtils {
return Map.of("ACTPath", ACTPath, "RFTPath", RFTPath); return Map.of("ACTPath", ACTPath, "RFTPath", RFTPath);
} }
private static void setCookieDomain(Cookie cookie, HttpServletRequest request, String domain) {
if (!request.getServerName().startsWith("loc.")) {
cookie.setDomain(domain);
}
}
private static void deleteLegacyDomainCookie(String name, String path, HttpServletRequest request, HttpServletResponse response, String domain) {
if (request.getServerName().startsWith("loc.")) {
addDomainDeleteCookie(name, path, domain, response);
int firstDot = domain.indexOf('.');
if (firstDot > 0) {
addDomainDeleteCookie(name, path, domain.substring(firstDot + 1), response);
}
}
}
private static void addDomainDeleteCookie(String name, String path, String domain, HttpServletResponse response) {
Cookie domainCookie = new Cookie(name, null);
domainCookie.setMaxAge(0);
domainCookie.setPath(path);
domainCookie.setDomain(domain);
domainCookie.setHttpOnly(true);
response.addCookie(domainCookie);
}
} }

View File

@@ -2659,7 +2659,7 @@
AND FGI.IMG_KND = '02' AND FGI.IMG_KND = '02'
AND FGI.CUT_NB = 1 AND FGI.CUT_NB = 1
LIMIT 1 LIMIT 1
) AS GOODS_IMG_COURS ) AS IMG
,FG.GOODS_NM ,FG.GOODS_NM
,FG.GOODS_ICON_CD AS ICON_CD_NM_LIST ,FG.GOODS_ICON_CD AS ICON_CD_NM_LIST
,FG.SRT_DC AS REPRSNT_DC ,FG.SRT_DC AS REPRSNT_DC

View File

@@ -486,7 +486,7 @@
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<button type="button" class="btn xsm primary ml-5" <button type="button" class="btn xsm primary ml-5"
onclick="fn_open_modal('#modalDiv','#product-search','/mngr/goods/goodsmngr/selectGoodsSrchPopupForm',{'goodsKndCd':'01'}); return false;"> onclick="selected = []; fn_open_modal('#modalDiv','#product-search','/mngr/goods/goodsmngr/selectGoodsSrchPopupForm',{'goodsKndCd':'01'}); return false;">
검색 검색
</button> </button>
</c:otherwise> </c:otherwise>