login 수정(1)
This commit is contained in:
@@ -21,6 +21,7 @@ import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.security.jwt.service.TokenService;
|
||||
import com.wb.domainserver.util.CookieUtils;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -65,12 +66,15 @@ public class MngrLoginController {
|
||||
@ResponseBody
|
||||
public void login(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
|
||||
String realm = RealmContextHolder.getRealm();
|
||||
String realm = RealmContextHolder.getRealm();
|
||||
|
||||
String redirectUri = request.getParameter("redirect_uri");
|
||||
String sopmalCd = RealmContextHolder.getSopmalCdRealm();
|
||||
String redirectUri = request.getParameter("redirect_uri");
|
||||
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
|
||||
) {
|
||||
|
||||
log.debug("loginRequest :: {}", loginRequest);
|
||||
log.debug("mngr loginRequest :: {}", loginRequest);
|
||||
|
||||
//로그인 진행
|
||||
LoginUser loginUser = null;
|
||||
@@ -126,7 +130,7 @@ public class MngrLoginController {
|
||||
|
||||
|
||||
|
||||
log.debug("loginUser :: {}", loginUser);
|
||||
log.debug("mngr loginUser :: {}", loginUser);
|
||||
|
||||
service.createLoginToken(loginUser, request, response);
|
||||
|
||||
@@ -178,11 +182,13 @@ public class MngrLoginController {
|
||||
|
||||
String refreshToken = CookieUtils.getCookieValue("RFT", request);
|
||||
|
||||
log.debug("refreshTokenValue :: {}", refreshToken);
|
||||
log.debug("mngr refreshTokenValue :: {}", refreshToken);
|
||||
|
||||
//리프레쉬 토큰이 없으면 메인으로 이동 처리
|
||||
if(!StringUtils.hasText(refreshToken)){
|
||||
|
||||
log.debug("리프레쉬 토큰이 없는 경우 realm :: {}", realm);
|
||||
|
||||
//엑세스토큰 삭제
|
||||
CookieUtils.deleteCookie("ACT","/"+realm, request, response);
|
||||
CookieUtils.deleteCookie("token_expire","/"+realm, request, response);
|
||||
@@ -214,6 +220,28 @@ public class MngrLoginController {
|
||||
@Policy(value = AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/login/loginCheck", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
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();
|
||||
vo.setMngrId(loginRequest.getUsername());
|
||||
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.Policy;
|
||||
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.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -65,10 +67,50 @@ public class MngrMainController {
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@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();
|
||||
|
||||
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);
|
||||
model.addAttribute("resultMap", content);
|
||||
return "mngr/index";
|
||||
@@ -83,6 +125,8 @@ public class MngrMainController {
|
||||
@ResponseBody
|
||||
public ResponseEntity<WnbtResponse> selectMngrMainChart1Inqire(@CookieValue(value = "authSopmalCd") String authSopmalCd, MainVO mainvo) {
|
||||
|
||||
log.debug("selectMngrMainChart1Inqire : authSopmalCd :{}", authSopmalCd);
|
||||
|
||||
mainvo.setSopmalCd(authSopmalCd);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
@@ -105,6 +149,8 @@ public class MngrMainController {
|
||||
@RequestMapping(value="/selectMngrMainChart2Inqire", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<WnbtResponse> selectMngrMainChart2Inqire(@CookieValue(value = "authSopmalCd") String authSopmalCd, MainVO mainvo) {
|
||||
|
||||
log.debug("selectMngrMainChart2Inqire : authSopmalCd :{}", authSopmalCd);
|
||||
|
||||
mainvo.setSopmalCd(authSopmalCd);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
DataMap vo = objectMapper.convertValue(mainvo, DataMap.class);
|
||||
@@ -128,6 +174,9 @@ public class MngrMainController {
|
||||
@RequestMapping(value = "/getPcUrl", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<WnbtResponse> getPcUrl(BOMaSopmalVO vo, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
|
||||
|
||||
log.debug("getPcUrl : authSopmalCd :{}", authSopmalCd);
|
||||
|
||||
vo.setSopmalCd(authSopmalCd);
|
||||
/*쇼핑몰 상세 조회 */
|
||||
List<DataMap> sopmalInfoList = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user