불필요 CSRF 제거

This commit is contained in:
KNKIM 2021-12-09 14:41:45 +09:00
parent 5338723ce2
commit e89959a55f
6 changed files with 11 additions and 49 deletions

View File

@ -82,16 +82,6 @@ public class ReadController extends NlibCommonController {
return retJsp;
}
if(!isValidCsrfToken(request, csrfToken)) {
if(fromCart && StringUtil.getString(fromPage, "").equalsIgnoreCase("login")) {
// 비로그인자의 카트에서 신청을 실행하여 로그인 신청 진입으로 돌아온 경우
return "redirect:/cart/listCartItems.do?cartTypeCd=2";
} else {
model.addAttribute("message", "잘못된 접근입니다.");
return retJsp;
}
}
if(readVO == null || StringUtil.isEmpty(readVO.getSelItems())) {
if(fromCart && StringUtil.getString(fromPage, "").equalsIgnoreCase("login")) {
// 비로그인자의 카트에서 신청을 실행하여 로그인 신청 진입으로 돌아온 경우

View File

@ -238,16 +238,6 @@ public class RentController extends NlibCommonController
return "nlib/rent/confirmRent";
}
if(!isValidCsrfToken(request, csrfToken)) {
if(fromCart && StringUtil.getString(fromPage, "").equalsIgnoreCase("login")) {
// 비로그인자의 카트에서 신청을 실행하여 로그인 신청 진입으로 돌아온 경우
return "redirect:/cart/listCartItems.do";
} else {
model.addAttribute("message", "잘못된 접근입니다.");
return "nlib/rent/confirmRent";
}
}
if(rentVO == null || StringUtil.isEmpty(rentVO.getSelItems())) {
if(fromCart && StringUtil.getString(fromPage, "").equalsIgnoreCase("login")) {
// 비로그인자의 카트에서 신청을 실행하여 로그인 신청 진입으로 돌아온 경우

View File

@ -225,7 +225,7 @@ public class NlibSearchController extends NlibCommonController {
}
secondClassList.get(i).put("cnt", Integer.toString(count));
}
// CSRF 토큰 생성 (2021.12.02 KKN 추가)
// CSRF 토큰 생성
String token = generateCsrfToken(request);
model.addAttribute("csrfToken", token);
@ -374,10 +374,6 @@ public class NlibSearchController extends NlibCommonController {
imagePath = StringUtil.getString(vo.getRprsThumbUrl(),"");
}
// CSRF 토큰 생성 (2021.12.02 KKN 추가)
String token = generateCsrfToken(request);
model.addAttribute("csrfToken", token);
model.addAttribute("imageType",imageType);
model.addAttribute("imagePath",imagePath);
model.addAttribute("keywordList",keywordList);
@ -473,7 +469,7 @@ public class NlibSearchController extends NlibCommonController {
model.addAttribute("firstClassList", codeService.listCodes(Constant.CODE_ID_MASTER_TYPE_DIV_CD));
model.addAttribute("secondClassList", codeService.listCodes(Constant.CODE_ID_DTLS_TYPE_DIV_CD));
// CSRF 토큰 생성 (2021.12.02 KKN 추가)
// CSRF 토큰 생성
String token = generateCsrfToken(request);
model.addAttribute("csrfToken", token);
return "nlib/search/getDetailedSearchFormPopup";

View File

@ -322,10 +322,10 @@ function goList(){
</ul>
</div>
<div class="b-btn">
<c:if test="${result.ableRentAppNow }"><button type="button" class="btn btn-color" title="새 창 열림" onclick="gfn_rentItem('${result.mngOrgCd}', '${result.masterId}', '${csrfToken }')">대출신청</button></c:if>
<c:if test="${not result.ableRentAppNow and result.ableRentResNow }"><button type="button" class="btn btn-color" title="새 창 열림" onclick="gfn_rentItem('${result.mngOrgCd}', '${result.masterId}', '${csrfToken }')">대출예약</button></c:if>
<c:if test="${result.ableRentAppNow }"><button type="button" class="btn btn-color" title="새 창 열림" onclick="gfn_rentItem('${result.mngOrgCd}', '${result.masterId}')">대출신청</button></c:if>
<c:if test="${not result.ableRentAppNow and result.ableRentResNow }"><button type="button" class="btn btn-color" title="새 창 열림" onclick="gfn_rentItem('${result.mngOrgCd}', '${result.masterId}')">대출예약</button></c:if>
<c:if test="${result.ableReadNow }"><button type="button" class="btn btn-green" title="새 창 열림" onclick="gfn_reserveReadItem('${result.mngOrgCd}', '${result.masterId}', '${csrfToken }')">방문열람신청</button></c:if>
<c:if test="${result.ableReadNow }"><button type="button" class="btn btn-green" title="새 창 열림" onclick="gfn_reserveReadItem('${result.mngOrgCd}', '${result.masterId}')">방문열람신청</button></c:if>
<c:if test="${result.ableRent or result.ableRead }">
<button type="button" class="btn btn-orange" onclick="gfn_addRentCart('${result.masterId}', '${result.ableRent}', '${result.ableRead}')">카트담기</button>

View File

@ -110,10 +110,6 @@ function fn_insertRentItems() {
}
function fn_gotoDetail(masterId) {
alert("상세보기 준비중 : " + masterId);
}
function fn_searchHome() {
location.href = "/search/searchList.do";
}
@ -191,7 +187,7 @@ $(document).ready(function() {
<!-- 행 : 시작 -->
<div class="list list-content">
<div class="t-data">
<div class="img"><a href="javascript:void(0)"><img src="${rent.rprsThumbUrlWithDefaultSmall }" alt="썸네일" width="60" height="91" title="상세보기" onclick="fn_gotoDetail('${rent.masterId }')"></a>
<div class="img"><a href="javascript:void(0)"><img src="${rent.rprsThumbUrlWithDefaultSmall }" alt="썸네일" width="60" height="91" title="상세보기" onclick="gfn_getDetail('${rent.masterId }')"></a>
<c:if test='${rent.MUseYn == "Y"}'>
<span id="favorites_${rent.masterId}" class="favorites" onclick="gfn_changeInterest('${rent.masterId }', 'off')" title="관심자료에서 삭제합니다.">
<img src="/images/icon/icon-cart-Favorites-on.png" class="off" alt="즐겨찾기 아이콘">
@ -217,7 +213,7 @@ $(document).ready(function() {
<span class="visit">방문열람</span>
</c:if>
</div>
<div class="title"><a href="javascript:void(0)" onclick="fn_gotoDetail('${rent.masterId }')" title="상세보기">${rent.title }</a></div>
<div class="title"><a href="javascript:void(0)" onclick="gfn_getDetail('${rent.masterId }')" title="상세보기">${rent.title }</a></div>
</div>
<div class="t-state"><p>${rent.useStatusNm }</p></div>
<div class="t-date">${rent.rtnExpctDd }</div>

View File

@ -520,37 +520,27 @@ function gfn_getDetail(masterId, host) {
return;
}
function gfn_rentItem(mngOrgCd, masterId, token) {
function gfn_rentItem(mngOrgCd, masterId) {
if(gfn_isEmpty(masterId)) {
alert("자료ID 정보가 없습니다.");
return;
}
if(gfn_isEmpty(token)) {
alert("잘못된 접근입니다.");
return;
}
var url = "/rent/confirmRent.do?mngOrgCd=" + mngOrgCd + "&selItems=" + masterId + "&csrfToken=" + token;
var url = "/rent/confirmRent.do?mngOrgCd=" + mngOrgCd + "&selItems=" + masterId;
gfn_openNewWindow(url);
return;
}
function gfn_reserveReadItem(mngOrgCd, masterId, token) {
function gfn_reserveReadItem(mngOrgCd, masterId) {
if(gfn_isEmpty(masterId)) {
alert("자료ID 정보가 없습니다.");
return;
}
if(gfn_isEmpty(token)) {
alert("잘못된 접근입니다.");
return;
}
var url = "/read/confirmRead.do?mngOrgCd=" + mngOrgCd + "&selItems=" + masterId + "&csrfToken=" + token;
var url = "/read/confirmRead.do?mngOrgCd=" + mngOrgCd + "&selItems=" + masterId;
gfn_openNewWindow(url);
return;