login 수정(1)
This commit is contained in:
@@ -89,11 +89,38 @@ public class AdminLoginController {
|
|||||||
|
|
||||||
loginRequest.setSopmalCd(RealmContextHolder.getSopmalCdRealm());
|
loginRequest.setSopmalCd(RealmContextHolder.getSopmalCdRealm());
|
||||||
|
|
||||||
|
//접속이력정보 세팅
|
||||||
|
String ip = String.valueOf(request.getAttribute("LoggingClientIp"));
|
||||||
|
loginRequest.setConectIp(ip);
|
||||||
|
//접속브라우저 정보 저장
|
||||||
|
String userAgent = request.getHeader("User-Agent");
|
||||||
|
String browser = "Other";
|
||||||
|
|
||||||
|
log.debug("login userAgent :: {}", userAgent);
|
||||||
|
|
||||||
|
if(userAgent.contains("Trident")) { // IE
|
||||||
|
browser = "ie";
|
||||||
|
} else if(userAgent.contains("Edg")) { // Edge
|
||||||
|
browser = "edge";
|
||||||
|
} else if(userAgent.contains("Whale")) { // Naver Whale
|
||||||
|
browser = "whale";
|
||||||
|
} else if(userAgent.contains("Opera") || userAgent.contains("OPR")) { // Opera
|
||||||
|
browser = "opera";
|
||||||
|
} else if(userAgent.contains("Firefox")) { // Firefox
|
||||||
|
browser = "firefox";
|
||||||
|
} else if(userAgent.contains("Safari") && !userAgent.contains("Chrome")) { // Safari
|
||||||
|
browser = "safari";
|
||||||
|
} else if(userAgent.contains("Chrome")) { // Chrome
|
||||||
|
browser = "chrome";
|
||||||
|
}
|
||||||
|
|
||||||
|
loginRequest.setConectBrwsr(browser);
|
||||||
|
|
||||||
loginUser = service.adminLogin(loginRequest);
|
loginUser = service.adminLogin(loginRequest);
|
||||||
loginUser.setSysDvCd("03");
|
loginUser.setSysDvCd("02");
|
||||||
|
|
||||||
|
|
||||||
log.debug("loginUser :: {}", loginUser);
|
log.debug("admin loginUser :: {}", loginUser);
|
||||||
|
|
||||||
//토큰 발급
|
//토큰 발급
|
||||||
service.createLoginToken(loginUser, request, response);
|
service.createLoginToken(loginUser, request, response);
|
||||||
@@ -144,6 +171,8 @@ public class AdminLoginController {
|
|||||||
|
|
||||||
String refreshToken = CookieUtils.getCookieValue("RFT", request);
|
String refreshToken = CookieUtils.getCookieValue("RFT", request);
|
||||||
|
|
||||||
|
log.debug("admin refreshTokenValue :: {}", refreshToken);
|
||||||
|
|
||||||
//리프레쉬 토큰이 없으면 메인으로 이동 처리
|
//리프레쉬 토큰이 없으면 메인으로 이동 처리
|
||||||
if(!StringUtils.hasText(refreshToken)){
|
if(!StringUtils.hasText(refreshToken)){
|
||||||
|
|
||||||
@@ -170,52 +199,52 @@ public class AdminLoginController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(request.getCookies() != null){
|
// if(request.getCookies() != null){
|
||||||
|
//
|
||||||
for(Cookie cookie: request.getCookies()){
|
// for(Cookie cookie: request.getCookies()){
|
||||||
|
//
|
||||||
if("RFT".equals(cookie.getName())){
|
// if("RFT".equals(cookie.getName())){
|
||||||
refreshToken = cookie.getValue();
|
// refreshToken = cookie.getValue();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
//리프레쉬 토큰이 없으면 메인으로 이동 처리
|
// //리프레쉬 토큰이 없으면 메인으로 이동 처리
|
||||||
if(!StringUtils.hasText(refreshToken)){
|
// if(!StringUtils.hasText(refreshToken)){
|
||||||
|
//
|
||||||
//엑세스토큰 삭제
|
// //엑세스토큰 삭제
|
||||||
if(request.getCookies() != null){
|
// if(request.getCookies() != null){
|
||||||
|
//
|
||||||
for(Cookie cookie: request.getCookies()){
|
// for(Cookie cookie: request.getCookies()){
|
||||||
|
//
|
||||||
if("ACT".equals(cookie.getName())){
|
// if("ACT".equals(cookie.getName())){
|
||||||
cookie.setMaxAge(0);
|
// cookie.setMaxAge(0);
|
||||||
response.addCookie(cookie);
|
// response.addCookie(cookie);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
response.sendRedirect("/"+realm.toLowerCase());
|
// response.sendRedirect("/"+realm.toLowerCase());
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
//리프레쉬 토큰 있을 경우(존재한다는 자체가 refresh토큰이 만료된 상태가 아님)
|
// //리프레쉬 토큰 있을 경우(존재한다는 자체가 refresh토큰이 만료된 상태가 아님)
|
||||||
service.createRenewLoginToken( request, response);
|
// service.createRenewLoginToken( request, response);
|
||||||
|
//
|
||||||
//리다이렉트 url 있을 경우 해당 url로 이동
|
// //리다이렉트 url 있을 경우 해당 url로 이동
|
||||||
if(StringUtils.hasText(request.getParameter("redirectUrl"))){
|
// if(StringUtils.hasText(request.getParameter("redirectUrl"))){
|
||||||
|
//
|
||||||
response.sendRedirect(request.getParameter("redirectUrl"));
|
// response.sendRedirect(request.getParameter("redirectUrl"));
|
||||||
|
//
|
||||||
}else{
|
// }else{
|
||||||
response.sendRedirect(UrlExtractor.getOriginalHost(request)+realm.toLowerCase());
|
// response.sendRedirect(UrlExtractor.getOriginalHost(request)+realm.toLowerCase());
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import org.springframework.web.util.UriUtils;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@@ -60,8 +61,9 @@ public class MaMainController {
|
|||||||
BOMaMainVO boMaMainVO = new BOMaMainVO();
|
BOMaMainVO boMaMainVO = new BOMaMainVO();
|
||||||
boMaMainVO.setMngrInnb(maMainVO.getMngrInnb());
|
boMaMainVO.setMngrInnb(maMainVO.getMngrInnb());
|
||||||
|
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
//쇼핑몰 조회
|
//쇼핑몰 조회
|
||||||
Map<String, Object> resultMap = service.selectBOMaMainAccessInqire(boMaMainVO);
|
resultMap.put("access", service.selectBOMaMainAccessInqire(boMaMainVO));
|
||||||
|
|
||||||
model.addAttribute("resultMap",resultMap);
|
model.addAttribute("resultMap",resultMap);
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class AuthController {
|
|||||||
@RequestMapping(value = "/selectMngrSopmalSite", produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/selectMngrSopmalSite", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public ResponseEntity<WnbtResponse> selectMngrSopmalSite(@RequestBody AuthVO vo, HttpServletRequest request, HttpServletResponse response) {
|
public ResponseEntity<WnbtResponse> selectMngrSopmalSite(@RequestBody AuthVO vo, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
|
log.debug("selectMngrSopmalSite SopmalCd :: {}", vo.getSopmalCd());
|
||||||
//기존 쿠기값 변경
|
//기존 쿠기값 변경
|
||||||
CookieUtils.deleteCookie("authSopmalCd", "/", request, response);
|
CookieUtils.deleteCookie("authSopmalCd", "/", request, response);
|
||||||
CookieUtils.createCookie("authSopmalCd",vo.getSopmalCd(), "/", true, request, response);
|
CookieUtils.createCookie("authSopmalCd",vo.getSopmalCd(), "/", true, request, response);
|
||||||
@@ -44,7 +45,7 @@ public class AuthController {
|
|||||||
// if(request.getCookies() != null) {
|
// if(request.getCookies() != null) {
|
||||||
// for(Cookie cookie : request.getCookies()){
|
// for(Cookie cookie : request.getCookies()){
|
||||||
// if("authSopmalCd".equals(cookie.getName())){
|
// if("authSopmalCd".equals(cookie.getName())){
|
||||||
// cookie.setPath("/mngr");
|
// cookie.setPath("/");
|
||||||
// cookie.setValue(vo.getSopmalCd());
|
// cookie.setValue(vo.getSopmalCd());
|
||||||
// response.addCookie(cookie);
|
// response.addCookie(cookie);
|
||||||
// break;
|
// break;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.wb.domainserver.security.authorization.annotation.Policy;
|
|||||||
import com.wb.domainserver.security.jwt.service.TokenService;
|
import com.wb.domainserver.security.jwt.service.TokenService;
|
||||||
import com.wb.domainserver.util.CookieUtils;
|
import com.wb.domainserver.util.CookieUtils;
|
||||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||||
|
import com.wb.domainserver.util.string.StringUtil;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -65,12 +66,15 @@ public class MngrLoginController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public void login(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
public void login(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
|
||||||
String realm = RealmContextHolder.getRealm();
|
String realm = RealmContextHolder.getRealm();
|
||||||
|
|
||||||
String redirectUri = request.getParameter("redirect_uri");
|
String redirectUri = request.getParameter("redirect_uri");
|
||||||
String sopmalCd = RealmContextHolder.getSopmalCdRealm();
|
String sopmalCd = RealmContextHolder.getSopmalCdRealm();
|
||||||
|
|
||||||
response.sendRedirect("/"+realm+"/login/page/"+realm+"?redirect_uri=%s&sopmalCd=%s".formatted(UriUtils.encode(redirectUri, StandardCharsets.UTF_8), UriUtils.encode(sopmalCd, StandardCharsets.UTF_8)));
|
log.debug("login-redirectUri :: {}", redirectUri);
|
||||||
|
log.debug("login-sopmalCd :: {}", sopmalCd);
|
||||||
|
|
||||||
|
response.sendRedirect("/"+realm+"/login/page/"+realm+"?redirect_uri=%s&sopmalCd=%s".formatted(UriUtils.encode(redirectUri, StandardCharsets.UTF_8), UriUtils.encode(sopmalCd, StandardCharsets.UTF_8)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -86,7 +90,7 @@ public class MngrLoginController {
|
|||||||
HttpServletResponse response
|
HttpServletResponse response
|
||||||
) {
|
) {
|
||||||
|
|
||||||
log.debug("loginRequest :: {}", loginRequest);
|
log.debug("mngr loginRequest :: {}", loginRequest);
|
||||||
|
|
||||||
//로그인 진행
|
//로그인 진행
|
||||||
LoginUser loginUser = null;
|
LoginUser loginUser = null;
|
||||||
@@ -126,7 +130,7 @@ public class MngrLoginController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
log.debug("loginUser :: {}", loginUser);
|
log.debug("mngr loginUser :: {}", loginUser);
|
||||||
|
|
||||||
service.createLoginToken(loginUser, request, response);
|
service.createLoginToken(loginUser, request, response);
|
||||||
|
|
||||||
@@ -178,11 +182,13 @@ public class MngrLoginController {
|
|||||||
|
|
||||||
String refreshToken = CookieUtils.getCookieValue("RFT", request);
|
String refreshToken = CookieUtils.getCookieValue("RFT", request);
|
||||||
|
|
||||||
log.debug("refreshTokenValue :: {}", refreshToken);
|
log.debug("mngr refreshTokenValue :: {}", refreshToken);
|
||||||
|
|
||||||
//리프레쉬 토큰이 없으면 메인으로 이동 처리
|
//리프레쉬 토큰이 없으면 메인으로 이동 처리
|
||||||
if(!StringUtils.hasText(refreshToken)){
|
if(!StringUtils.hasText(refreshToken)){
|
||||||
|
|
||||||
|
log.debug("리프레쉬 토큰이 없는 경우 realm :: {}", realm);
|
||||||
|
|
||||||
//엑세스토큰 삭제
|
//엑세스토큰 삭제
|
||||||
CookieUtils.deleteCookie("ACT","/"+realm, request, response);
|
CookieUtils.deleteCookie("ACT","/"+realm, request, response);
|
||||||
CookieUtils.deleteCookie("token_expire","/"+realm, request, response);
|
CookieUtils.deleteCookie("token_expire","/"+realm, request, response);
|
||||||
@@ -214,6 +220,28 @@ public class MngrLoginController {
|
|||||||
@Policy(value = AuthPolicy.PUBLIC)
|
@Policy(value = AuthPolicy.PUBLIC)
|
||||||
@PostMapping(value = "/login/loginCheck", produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = "/login/loginCheck", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public ResponseEntity<?> loginCheck(@RequestBody LoginRequest loginRequest, HttpServletRequest request, HttpServletResponse response) {
|
public ResponseEntity<?> loginCheck(@RequestBody LoginRequest loginRequest, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
log.debug("mngr loginCheck!!");
|
||||||
|
|
||||||
|
String queryString = request.getParameter("authSopmalCd");
|
||||||
|
log.debug("mngr loginCheck getParameter authSopmalCd :: {}", queryString);
|
||||||
|
// String authSopmalCd = "";
|
||||||
|
// if (!StringUtil.isEmpty(queryString) && sopmalList.contains(queryString)) {
|
||||||
|
// // 로그인 요청 쇼핑몰 param 저장
|
||||||
|
// authSopmalCd = queryString;
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// if("".equals(authVO.getSopmalCd()) || authVO.getSopmalCd() == null){
|
||||||
|
// //쿠키에 권한 리스트중 첫번째 쇼핑몰 param 저장
|
||||||
|
// if (!sopmalList.isEmpty()) {
|
||||||
|
// authSopmalCd = sopmalList.get(0);
|
||||||
|
// } else {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// authSopmalCd = authVO.getSopmalCd();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
BOJobUserVO vo = new BOJobUserVO();
|
BOJobUserVO vo = new BOJobUserVO();
|
||||||
vo.setMngrId(loginRequest.getUsername());
|
vo.setMngrId(loginRequest.getUsername());
|
||||||
vo.setPassword(loginRequest.getPassword());
|
vo.setPassword(loginRequest.getPassword());
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
|||||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||||
|
import com.wb.domainserver.util.string.StringUtil;
|
||||||
|
import jakarta.servlet.http.Cookie;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -65,10 +67,50 @@ public class MngrMainController {
|
|||||||
*/
|
*/
|
||||||
@Policy(AuthPolicy.PUBLIC)
|
@Policy(AuthPolicy.PUBLIC)
|
||||||
@RequestMapping(value = "/main")
|
@RequestMapping(value = "/main")
|
||||||
public String selectMngrMainInqire(@CookieValue(value = "authSopmalCd") String authSopmalCd, ModelMap model, HttpServletRequest request) {
|
// public String selectMngrMainInqire(@CookieValue(value = "authSopmalCd") String authSopmalCd, ModelMap model, HttpServletRequest request) {
|
||||||
|
public String selectMngrMainInqire(String authSopmalCd, ModelMap model, HttpServletRequest request ) {
|
||||||
DataMap vo = new DataMap();
|
DataMap vo = new DataMap();
|
||||||
|
|
||||||
vo.put("sopmalCd", authSopmalCd);
|
log.debug("authSopmalCd index1 {}", authSopmalCd);
|
||||||
|
|
||||||
|
if("".equals(authSopmalCd)|| authSopmalCd == null) {
|
||||||
|
log.debug("index authSopmalCd is null");
|
||||||
|
authSopmalCd = request.getAttribute("authSopmalCd") != null ? request.getAttribute("authSopmalCd").toString() : "";
|
||||||
|
// log.debug("request Attribute authSopmalCd X");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug("authSopmalCd index2 {}", authSopmalCd);
|
||||||
|
|
||||||
|
String sopmalCd = "";
|
||||||
|
|
||||||
|
//최초 로그인이 아니면 쿠키에서 쇼핑몰정보 조회
|
||||||
|
if(StringUtil.isEmpty(authSopmalCd)) {
|
||||||
|
|
||||||
|
if(request.getCookies()!=null) {
|
||||||
|
|
||||||
|
for(Cookie cookie : request.getCookies()){
|
||||||
|
if("authSopmalCd".equals(cookie.getName())){
|
||||||
|
sopmalCd = cookie.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
sopmalCd = authSopmalCd;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug("main sopmalCd set {}", sopmalCd);
|
||||||
|
|
||||||
|
vo.put("sopmalCd", sopmalCd);
|
||||||
|
|
||||||
|
//쇼핑몰 지정후 메인 이동시 sopmalCd 세팅
|
||||||
|
model.addAttribute("cookieAuthSopmalCd", sopmalCd);
|
||||||
|
|
||||||
|
log.debug("mainindex {}", model.getAttribute("cookieAuthSopmalCd"));
|
||||||
|
|
||||||
|
// vo.put("sopmalCd", authSopmalCd);
|
||||||
Map<String, Object> content = service.selectBOMngrMainInqire(vo);
|
Map<String, Object> content = service.selectBOMngrMainInqire(vo);
|
||||||
model.addAttribute("resultMap", content);
|
model.addAttribute("resultMap", content);
|
||||||
return "mngr/index";
|
return "mngr/index";
|
||||||
@@ -83,6 +125,8 @@ public class MngrMainController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseEntity<WnbtResponse> selectMngrMainChart1Inqire(@CookieValue(value = "authSopmalCd") String authSopmalCd, MainVO mainvo) {
|
public ResponseEntity<WnbtResponse> selectMngrMainChart1Inqire(@CookieValue(value = "authSopmalCd") String authSopmalCd, MainVO mainvo) {
|
||||||
|
|
||||||
|
log.debug("selectMngrMainChart1Inqire : authSopmalCd :{}", authSopmalCd);
|
||||||
|
|
||||||
mainvo.setSopmalCd(authSopmalCd);
|
mainvo.setSopmalCd(authSopmalCd);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
@@ -105,6 +149,8 @@ public class MngrMainController {
|
|||||||
@RequestMapping(value="/selectMngrMainChart2Inqire", produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value="/selectMngrMainChart2Inqire", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public ResponseEntity<WnbtResponse> selectMngrMainChart2Inqire(@CookieValue(value = "authSopmalCd") String authSopmalCd, MainVO mainvo) {
|
public ResponseEntity<WnbtResponse> selectMngrMainChart2Inqire(@CookieValue(value = "authSopmalCd") String authSopmalCd, MainVO mainvo) {
|
||||||
|
|
||||||
|
log.debug("selectMngrMainChart2Inqire : authSopmalCd :{}", authSopmalCd);
|
||||||
|
|
||||||
mainvo.setSopmalCd(authSopmalCd);
|
mainvo.setSopmalCd(authSopmalCd);
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
DataMap vo = objectMapper.convertValue(mainvo, DataMap.class);
|
DataMap vo = objectMapper.convertValue(mainvo, DataMap.class);
|
||||||
@@ -128,6 +174,9 @@ public class MngrMainController {
|
|||||||
@RequestMapping(value = "/getPcUrl", produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/getPcUrl", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseEntity<WnbtResponse> getPcUrl(BOMaSopmalVO vo, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
|
public ResponseEntity<WnbtResponse> getPcUrl(BOMaSopmalVO vo, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
|
||||||
|
|
||||||
|
log.debug("getPcUrl : authSopmalCd :{}", authSopmalCd);
|
||||||
|
|
||||||
vo.setSopmalCd(authSopmalCd);
|
vo.setSopmalCd(authSopmalCd);
|
||||||
/*쇼핑몰 상세 조회 */
|
/*쇼핑몰 상세 조회 */
|
||||||
List<DataMap> sopmalInfoList = new ArrayList<>();
|
List<DataMap> sopmalInfoList = new ArrayList<>();
|
||||||
|
|||||||
@@ -967,10 +967,6 @@ public class MainController {
|
|||||||
.resBody(new WnbtResponseBody(message))
|
.resBody(new WnbtResponseBody(message))
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
// return responseHandler.handleResponse(
|
|
||||||
// sendToResrc.ofPost(RESRC.GCONEBO, "/ajax/gcone/setup/site/selectBOMainSiteDesignCtgryListInqire", vo),
|
|
||||||
// ReplyFromResrc::getReply
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -35,36 +35,65 @@ public class MngrAuthInterceptor implements HandlerInterceptor{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||||
|
|
||||||
|
AuthVO authVO = new AuthVO();
|
||||||
|
|
||||||
//쿠키 쇼핑몰 코드 조회
|
//쿠키 쇼핑몰 코드 조회
|
||||||
String cookieAuthSopmalCd = CookieUtils.getCookieValue("authSopmalCd", request);
|
String cookieAuthSopmalCd = CookieUtils.getCookieValue("authSopmalCd", request);
|
||||||
|
|
||||||
|
logger.debug("cookieAuthSopmalCd param1 :: {}", cookieAuthSopmalCd);
|
||||||
|
|
||||||
|
if(!"".equals(cookieAuthSopmalCd) && cookieAuthSopmalCd != null){
|
||||||
|
authVO.setSopmalCd(cookieAuthSopmalCd);
|
||||||
|
}
|
||||||
|
|
||||||
|
//관리자 권한 조회
|
||||||
|
boolean authChk = mngrAuthChk(request, response, user, authVO);
|
||||||
|
|
||||||
|
|
||||||
//쿠키 쇼핑몰 코드 없을 경우 쿠키 생성 및 쇼핑몰코드 변수저장
|
//쿠키 쇼핑몰 코드 없을 경우 쿠키 생성 및 쇼핑몰코드 변수저장
|
||||||
if (!StringUtils.hasText(cookieAuthSopmalCd)) {
|
if (!StringUtils.hasText(cookieAuthSopmalCd)) {
|
||||||
//통합관리자인경우
|
//통합관리자인경우
|
||||||
if ("ADMIN".equals(RealmContextHolder.getSopmalCdRealm())) {
|
if ("ADMIN".equals(RealmContextHolder.getSopmalCdRealm())) {
|
||||||
|
logger.debug("SopmalCdRealm ADMIN!");
|
||||||
CookieUtils.createCookie("authSopmalCd", "SYS", "/", true, request, response);
|
CookieUtils.createCookie("authSopmalCd", "SYS", "/", true, request, response);
|
||||||
cookieAuthSopmalCd = "SYS";
|
cookieAuthSopmalCd = "SYS";
|
||||||
|
|
||||||
} else {
|
}
|
||||||
/*쿠키에 authSopmalCd가 없으면 초기화*/
|
|
||||||
if(StringUtil.isEmpty(cookieAuthSopmalCd)){
|
/*쿠키에 authSopmalCd가 없으면 초기화*/
|
||||||
CookieUtils.createCookie("authSopmalCd", RealmContextHolder.getSopmalCdRealm(), "/", true, request, response);
|
if(StringUtil.isEmpty(cookieAuthSopmalCd)){
|
||||||
cookieAuthSopmalCd = RealmContextHolder.getSopmalCdRealm();
|
logger.debug("cookieAuthSopmalCd isEmpty");
|
||||||
}
|
// CookieUtils.createCookie("authSopmalCd", RealmContextHolder.getSopmalCdRealm(), "/", true, request, response);
|
||||||
|
// cookieAuthSopmalCd = RealmContextHolder.getSopmalCdRealm();
|
||||||
|
CookieUtils.createCookie("authSopmalCd", authVO.getSopmalCd(), "/", true, request, response);
|
||||||
|
cookieAuthSopmalCd = authVO.getSopmalCd();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(!cookieAuthSopmalCd.equals(authVO.getSopmalCd())) {
|
||||||
|
logger.debug("cookieAuthSopmalCd is Diff.");
|
||||||
|
CookieUtils.createCookie("authSopmalCd", authVO.getSopmalCd(), "/", true, request, response);
|
||||||
|
cookieAuthSopmalCd = authVO.getSopmalCd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
logger.debug("cookieAuthSopmalCd param2 :: {}", cookieAuthSopmalCd);
|
||||||
|
|
||||||
|
// AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //관리자 권한 조회
|
||||||
|
// boolean authChk = mngrAuthChk(request, response, user);
|
||||||
|
|
||||||
//관리자 권한 조회
|
// CookieUtils.createCookie("authSopmalCd", authSopmalCd, "/", true, request, response);
|
||||||
boolean authChk = mngrAuthChk(request, response, user);
|
// cookieAuthSopmalCd = CookieUtils.getCookieValue("authSopmalCd", request);
|
||||||
|
|
||||||
//해당 페이지에 접근권한이 없으면 alert
|
//해당 페이지에 접근권한이 없으면 alert
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if (authChk) {
|
if (authChk) {
|
||||||
AuthVO authVO = new AuthVO();
|
// AuthVO authVO = new AuthVO();
|
||||||
authVO.setMngrInnb(user.getUserInnb());
|
authVO.setMngrInnb(user.getUserInnb());
|
||||||
authVO.setSopmalCd(cookieAuthSopmalCd);
|
authVO.setSopmalCd(cookieAuthSopmalCd);
|
||||||
authVO.setSysDvCd(user.getSysDvCd());
|
authVO.setSysDvCd(user.getSysDvCd());
|
||||||
@@ -101,9 +130,9 @@ public class MngrAuthInterceptor implements HandlerInterceptor{
|
|||||||
* @param response res
|
* @param response res
|
||||||
* @param user 유저정보
|
* @param user 유저정보
|
||||||
*/
|
*/
|
||||||
private boolean mngrAuthChk (HttpServletRequest request, HttpServletResponse response, AnonymousUser user){
|
private boolean mngrAuthChk (HttpServletRequest request, HttpServletResponse response, AnonymousUser user, AuthVO authVO){
|
||||||
//권한 리스트 조회
|
//권한 리스트 조회
|
||||||
AuthVO authVO = new AuthVO();
|
// AuthVO authVO = new AuthVO();
|
||||||
authVO.setMngrInnb(user.getUserInnb());
|
authVO.setMngrInnb(user.getUserInnb());
|
||||||
List<String> sopmalList = authService.selectAuthorSopmalList(authVO);
|
List<String> sopmalList = authService.selectAuthorSopmalList(authVO);
|
||||||
logger.debug("sopmalList {}", sopmalList);
|
logger.debug("sopmalList {}", sopmalList);
|
||||||
@@ -118,15 +147,22 @@ public class MngrAuthInterceptor implements HandlerInterceptor{
|
|||||||
authSopmalCd = queryString;
|
authSopmalCd = queryString;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//쿠키에 권한 리스트중 첫번째 쇼핑몰 param 저장
|
if("".equals(authVO.getSopmalCd()) || authVO.getSopmalCd() == null){
|
||||||
if (!sopmalList.isEmpty()) {
|
//쿠키에 권한 리스트중 첫번째 쇼핑몰 param 저장
|
||||||
authSopmalCd = sopmalList.get(0);
|
if (!sopmalList.isEmpty()) {
|
||||||
|
authSopmalCd = sopmalList.get(0);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
authSopmalCd = authVO.getSopmalCd();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("authSopmalCd set :: {}", authSopmalCd);
|
||||||
|
|
||||||
|
authVO.setSopmalCd(authSopmalCd);
|
||||||
|
|
||||||
CookieUtils.createCookie("authSopmalCd", authSopmalCd, "/", true, request, response);
|
CookieUtils.createCookie("authSopmalCd", authSopmalCd, "/", true, request, response);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.wb.domainserver.interceptor.wrapper.MultipleReadableRequestWrapper;
|
|||||||
import com.wb.domainserver.realm.util.UrlExtractor;
|
import com.wb.domainserver.realm.util.UrlExtractor;
|
||||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||||
|
import com.wb.domainserver.util.CookieUtils;
|
||||||
import com.wb.domainserver.util.string.StringUtil;
|
import com.wb.domainserver.util.string.StringUtil;
|
||||||
import jakarta.servlet.http.Cookie;
|
import jakarta.servlet.http.Cookie;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@@ -214,25 +215,30 @@ public class MngrLoggingInterceptor implements HandlerInterceptor {
|
|||||||
logVo.setMngrTyCd(mngrTy);
|
logVo.setMngrTyCd(mngrTy);
|
||||||
logVo.setMngrInnb(user.getUserInnb());
|
logVo.setMngrInnb(user.getUserInnb());
|
||||||
|
|
||||||
|
logger.debug("request.getRequestURI :: {}", request.getRequestURI());
|
||||||
|
|
||||||
String authSopmalCd = "";
|
String authSopmalCd = "";
|
||||||
|
|
||||||
//관리자 메인 진입시 쇼핑몰 선택했을 경우(로그인시)
|
//관리자 메인 진입시 쇼핑몰 선택했을 경우(로그인시)
|
||||||
if( "/mngr/main".equals(request.getRequestURI()) && !StringUtil.isEmpty(request.getParameter("authSopmalCd"))){
|
if( ("/mngr/login/loginCheck".equals(request.getRequestURI()) || "/mngr/main".equals(request.getRequestURI())) && !StringUtil.isEmpty(request.getParameter("authSopmalCd"))){
|
||||||
authSopmalCd = request.getParameter("authSopmalCd");
|
authSopmalCd = request.getParameter("authSopmalCd");
|
||||||
}
|
logger.debug("request.getParamete authSopmalCd :: {}", authSopmalCd);
|
||||||
|
CookieUtils.createCookie("authSopmalCd", authSopmalCd, "/", true, request, response);
|
||||||
//이후 사이트 이동시
|
} else {
|
||||||
if(request.getCookies() != null){
|
//이후 사이트 이동시
|
||||||
for(Cookie cookie : request.getCookies()){
|
if(request.getCookies() != null){
|
||||||
if(cookie.getName().equals("authSopmalCd")){
|
for(Cookie cookie : request.getCookies()){
|
||||||
authSopmalCd = cookie.getValue();
|
if(cookie.getName().equals("authSopmalCd")){
|
||||||
break;
|
authSopmalCd = cookie.getValue();
|
||||||
|
logger.debug("cookie.getValue authSopmalCd :: {}", authSopmalCd);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("insertMngrAccessLog setSopmalCd :: {}", authSopmalCd);
|
||||||
|
|
||||||
logVo.setSopmalCd(authSopmalCd);
|
logVo.setSopmalCd(authSopmalCd);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.wb.domainserver.domain.admin.sys.author.service.BOMaAuthorService;
|
|||||||
import com.wb.domainserver.domain.admin.sys.author.vo.BOMaAuthorVO;
|
import com.wb.domainserver.domain.admin.sys.author.vo.BOMaAuthorVO;
|
||||||
import com.wb.domainserver.domain.admin.sys.menu.service.BOMaMenuService;
|
import com.wb.domainserver.domain.admin.sys.menu.service.BOMaMenuService;
|
||||||
import com.wb.domainserver.domain.admin.sys.menu.vo.BOMaMenuVO;
|
import com.wb.domainserver.domain.admin.sys.menu.vo.BOMaMenuVO;
|
||||||
|
import com.wb.domainserver.domain.auth.service.AuthService;
|
||||||
|
import com.wb.domainserver.domain.auth.vo.AuthVO;
|
||||||
import com.wb.domainserver.domain.gcone.mbr.mbr.service.BOMbrService;
|
import com.wb.domainserver.domain.gcone.mbr.mbr.service.BOMbrService;
|
||||||
import com.wb.domainserver.domain.gcone.mbr.mbr.vo.BOMbrVO;
|
import com.wb.domainserver.domain.gcone.mbr.mbr.vo.BOMbrVO;
|
||||||
import com.wb.domainserver.realm.RealmContextHolder;
|
import com.wb.domainserver.realm.RealmContextHolder;
|
||||||
@@ -24,6 +26,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
|||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class MngrMenuInterceptor implements HandlerInterceptor {
|
public class MngrMenuInterceptor implements HandlerInterceptor {
|
||||||
@@ -33,6 +36,9 @@ public class MngrMenuInterceptor implements HandlerInterceptor {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BOMaMenuService menuService;
|
private BOMaMenuService menuService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AuthService authService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BOMaAuthorService boMaAuthorService;
|
private BOMaAuthorService boMaAuthorService;
|
||||||
|
|
||||||
@@ -129,23 +135,53 @@ public class MngrMenuInterceptor implements HandlerInterceptor {
|
|||||||
//관리자 메인 진입시 쇼핑몰 선택했을 경우(로그인시)
|
//관리자 메인 진입시 쇼핑몰 선택했을 경우(로그인시)
|
||||||
if( "/mngr/main".equals(request.getRequestURI()) && !StringUtil.isEmpty(request.getParameter("authSopmalCd"))){
|
if( "/mngr/main".equals(request.getRequestURI()) && !StringUtil.isEmpty(request.getParameter("authSopmalCd"))){
|
||||||
cookieAuthSopmalCd = request.getParameter("authSopmalCd");
|
cookieAuthSopmalCd = request.getParameter("authSopmalCd");
|
||||||
}
|
logger.debug("cookieAuthSopmalCd param3 :: {}", cookieAuthSopmalCd);
|
||||||
|
} else {
|
||||||
|
if (request.getCookies() != null) {
|
||||||
|
|
||||||
if (request.getCookies() != null) {
|
Cookie[] cookies = request.getCookies();
|
||||||
|
|
||||||
Cookie[] cookies = request.getCookies();
|
for(Cookie cookie : cookies) {
|
||||||
|
if("authSopmalCd".equals(cookie.getName())){
|
||||||
for(Cookie cookie : cookies) {
|
cookieAuthSopmalCd = cookie.getValue();
|
||||||
if("authSopmalCd".equals(cookie.getName())){
|
break;
|
||||||
cookieAuthSopmalCd = cookie.getValue();
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("cookieAuthSopmalCd param4 :: {}", cookieAuthSopmalCd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!StringUtils.hasText(cookieAuthSopmalCd)){
|
if(!StringUtils.hasText(cookieAuthSopmalCd)){
|
||||||
cookieAuthSopmalCd = RealmContextHolder.getSopmalCdRealm();
|
// cookieAuthSopmalCd = RealmContextHolder.getSopmalCdRealm();
|
||||||
|
AuthVO authVO = new AuthVO();
|
||||||
|
authVO.setMngrInnb(mngr.getUserInnb());
|
||||||
|
List<String> sopmalList = authService.selectAuthorSopmalList(authVO);
|
||||||
|
logger.debug("sopmalList_menu {}", sopmalList);
|
||||||
|
//로그인 요청 쇼핑몰 param 조회
|
||||||
|
String queryString = request.getParameter("authSopmalCd");
|
||||||
|
logger.debug("authSopmalCd queryString :: {}", queryString);
|
||||||
|
//권한 리스트에 로그인 요청 쇼핑몰 param이 포함되면
|
||||||
|
|
||||||
|
String authSopmalCd = "";
|
||||||
|
if (!StringUtil.isEmpty(queryString) && sopmalList.contains(queryString)) {
|
||||||
|
// 로그인 요청 쇼핑몰 param 저장
|
||||||
|
authSopmalCd = queryString;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//쿠키에 권한 리스트중 첫번째 쇼핑몰 param 저장
|
||||||
|
if (!sopmalList.isEmpty()) {
|
||||||
|
authSopmalCd = sopmalList.get(0);
|
||||||
|
} else {
|
||||||
|
authSopmalCd = RealmContextHolder.getSopmalCdRealm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cookieAuthSopmalCd = authSopmalCd;
|
||||||
|
request.setAttribute("authSopmalCd", authSopmalCd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("cookieAuthSopmalCd param5 :: {}", cookieAuthSopmalCd);
|
||||||
|
|
||||||
|
|
||||||
vo.setSopmalCd(cookieAuthSopmalCd);
|
vo.setSopmalCd(cookieAuthSopmalCd);
|
||||||
|
|
||||||
|
|||||||
@@ -350,6 +350,9 @@ mngrfo:
|
|||||||
web: /webFile
|
web: /webFile
|
||||||
extensions:
|
extensions:
|
||||||
images: .gif,.jpg,.jpeg,.png
|
images: .gif,.jpg,.jpeg,.png
|
||||||
|
cdnurl: http://dev.img.gcone.co.kr
|
||||||
|
|
||||||
|
|
||||||
secret:
|
secret:
|
||||||
key: 1df5be2f7e90ae36
|
key: 1df5be2f7e90ae36
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,8 @@
|
|||||||
<a href="javascript:void(0);">
|
<a href="javascript:void(0);">
|
||||||
<img class="login__logo active" src="/login/mngr/images/logo_default.png" alt="gcone">
|
<img class="login__logo active" src="/login/mngr/images/logo_default.png" alt="gcone">
|
||||||
<c:forEach var="site" items="${siteList}">
|
<c:forEach var="site" items="${siteList}">
|
||||||
<img class="login__logo" data-brand="${site.sopmalCd}" src="@{${cdnurl}+${site.topFilCours}+'/'+${site.topSysFilNm}}" alt="${site.sopmalNm}">
|
<%-- <img class="login__logo" data-brand="${site.sopmalCd}" src="@{${cdnurl}+${site.topFilCours}+'/'+${site.topSysFilNm}}" alt="${site.sopmalNm}">--%>
|
||||||
|
<img class="login__logo" data-brand="${site.sopmalCd}" src="${cdnurl}${site.topFilCours}/${site.topSysFilNm}" alt="${site.sopmalNm}">
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</a>
|
</a>
|
||||||
<div class="header__siteSelectArrow"><span class="visually-hidden">사이트 선택</span></div>
|
<div class="header__siteSelectArrow"><span class="visually-hidden">사이트 선택</span></div>
|
||||||
@@ -126,7 +127,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script defer>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('.login__logo').click(function () {
|
$('.login__logo').click(function () {
|
||||||
$('.login__logo').removeClass('active');
|
$('.login__logo').removeClass('active');
|
||||||
|
|||||||
Reference in New Issue
Block a user