이지우 - 로그인 진행 중 & profiles.active가 tLocal일 경우 로그인 처리 추가
This commit is contained in:
parent
a26ad59ccd
commit
412feb7a0e
@ -51,6 +51,7 @@ public class CoreConstant {
|
||||
public static final String PROFILE_LOCAL = "local";
|
||||
public static final String PROFILE_DEV = "dev";
|
||||
public static final String PROFILE_PROD = "prod";
|
||||
public static final String PROFILE_TLOCAL = "tLocal";
|
||||
|
||||
|
||||
/* Menu role */
|
||||
|
||||
@ -15,6 +15,7 @@ public class ProfileUtil {
|
||||
private static boolean isLocal = false;
|
||||
private static boolean isDev = false;
|
||||
private static boolean isProd = false;
|
||||
private static boolean isTLocal = false;
|
||||
|
||||
@Autowired
|
||||
public void setEnvironment(Environment environment) {
|
||||
@ -31,6 +32,8 @@ public class ProfileUtil {
|
||||
ProfileUtil.isProd = true;
|
||||
} else if (CoreConstant.PROFILE_LOCAL.equalsIgnoreCase(profiles[i])) {
|
||||
ProfileUtil.isLocal = true;
|
||||
}else if (CoreConstant.PROFILE_TLOCAL.equalsIgnoreCase(profiles[i])) {
|
||||
ProfileUtil.isTLocal = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -51,6 +54,10 @@ public class ProfileUtil {
|
||||
return ProfileUtil.isDev;
|
||||
}
|
||||
|
||||
public static boolean isTLocal() {
|
||||
return ProfileUtil.isTLocal;
|
||||
}
|
||||
|
||||
public static boolean isProd() {
|
||||
return ProfileUtil.isProd;
|
||||
}
|
||||
|
||||
@ -94,4 +94,6 @@ public interface EgovLoginService {
|
||||
LoginVO selectOffeduMberChk(LoginVO vo) throws Exception;
|
||||
|
||||
void updateMberSeqKeyAjax(LoginVO vo) throws Exception;
|
||||
|
||||
void updateMberSeqKeyNull(LoginVO vo) throws Exception;
|
||||
}
|
||||
|
||||
@ -286,4 +286,9 @@ public class EgovLoginServiceImpl extends EgovAbstractServiceImpl implements
|
||||
public void updateMberSeqKeyAjax(LoginVO vo) throws Exception {
|
||||
loginDAO.updateMberSeqKeyAjax(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMberSeqKeyNull(LoginVO vo) throws Exception {
|
||||
loginDAO.updateMberSeqKeyNull(vo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,4 +140,9 @@ public class LoginDAO extends EgovAbstractDAO {
|
||||
update("loginDAO.updateMberSeqKeyAjax", vo);
|
||||
|
||||
}
|
||||
|
||||
public void updateMberSeqKeyNull(LoginVO vo) throws Exception{
|
||||
update("loginDAO.updateMberSeqKeyNull", vo);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@ -44,6 +45,7 @@ import kcc.let.utl.sim.service.EgovClntInfo;
|
||||
* @version 1.0
|
||||
* @see
|
||||
*/
|
||||
@CrossOrigin(origins = "*")
|
||||
@Controller
|
||||
public class APILoginContoller {
|
||||
|
||||
@ -70,30 +72,35 @@ public class APILoginContoller {
|
||||
String key = paramRequest.get("key");
|
||||
String returnUrl = paramRequest.get("returnUrl");
|
||||
|
||||
System.out.println("@@@@@@@e배움터 로그인 페이지에서 오는 메소드 or e배움터 로그인 상태에서 오는 메소드@@@@@@@@");
|
||||
//테스트를 위한 값 선언
|
||||
userId = "std02@forwiz.com";
|
||||
key = "std02@forwiz.comnPPp8JU56YuznXtm91YlcItGzg52zxNVax6aS6OrsaWZzSV6xPnMKnL0OOUbJzkg.amV1c19kb21haW4vTE1T";
|
||||
returnUrl = "/web/main/mainPage.do";
|
||||
/*userId = "std02@forwiz.com";
|
||||
key = "std02@forwiz.comxpnBtqsev3nh9mryXRdL9QRSR72XuNc08ese5iXHb0Waq1dMnSdkHHqKCgoSFeyH.amV1c19kb21haW4vTE1T";
|
||||
returnUrl = "/web/main/mainPage.do";*/
|
||||
|
||||
if(userId == null || key == null) {
|
||||
return "redirect:/web/main/mainPage.do";
|
||||
}
|
||||
|
||||
Map<String, String> result = loginKeytoEEdu(userId, key);
|
||||
System.out.println("@@@@@@@@@@e배움터 API 결과:"+result);
|
||||
System.out.println("@@@@@@@@@@e배움터 API code 결과:"+result.get("resultCode"));
|
||||
System.out.println("@@@@@@@@@@e배움터 API messea 결과:"+result.get("message"));
|
||||
String resultCode = result.get("resultCode");
|
||||
String message = result.get("message");
|
||||
|
||||
|
||||
if(resultCode.equals("1")) { //API 성공
|
||||
System.out.println("@@@@@@@@@@API성공@@@@@@@@");
|
||||
returnUrl = "/web/main/mainPage.do";//임시 url
|
||||
|
||||
//회원테이블에 없던 회원이면 insert, 있던 회원이면 update
|
||||
UserManageVO userManageVO = new UserManageVO();
|
||||
userManageVO.setMberId(userId);
|
||||
UserManageVO userManageChk = userManageService.selectOffeduUser(userManageVO);
|
||||
if(userManageChk == null) {
|
||||
userManageVO.setAuthorCode("ROLE_USER_MEMBER");
|
||||
userManageService.insertOffeduUser(userManageVO);
|
||||
userManageVO.setAuthorCode("ROLE_USER_MEMBER");
|
||||
userManageService.insertOffeduUser(userManageVO);
|
||||
System.out.println("@@@@@@@@@@찾교에 계정생성@@@@@@@@@@");
|
||||
}
|
||||
//로그인 처리 시작
|
||||
LoginVO loginVO = new LoginVO();
|
||||
@ -122,6 +129,7 @@ public class APILoginContoller {
|
||||
}
|
||||
springSecurity.doFilter(new RequestWrapperForSecurity(request, resultVO.getUserSe() + resultVO.getId(), resultVO.getUniqId()), response, null);
|
||||
//doFilter 처리 시 redirect가 불가능하여, context-security.xml에서 login url로 이동 후 redirect 처리
|
||||
System.out.println("@@@@@@@@@@@@@@로그인 처리 완료@@@@@@@@@@@");
|
||||
return "blank";
|
||||
}else if(resultCode.equals("-101")) { //세션 값 만료
|
||||
redirectAttributes.addFlashAttribute("message", message);
|
||||
@ -154,6 +162,7 @@ public class APILoginContoller {
|
||||
public Map<String, String> loginKeytoEEdu(String user_id, String key){
|
||||
HashMap<String, String> resultMap = new HashMap<String, String>();
|
||||
try {
|
||||
System.out.println("@@@@@@@@@@@e배움터API시작 id:"+user_id+"key:"+key+"@@@@@@@@@@");
|
||||
// 파라미터 key, user_id를 postData에 넣음
|
||||
StringBuilder postData = new StringBuilder();
|
||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
@ -191,11 +200,12 @@ public class APILoginContoller {
|
||||
|
||||
resultMap.put("resultCode", resultCodeString);
|
||||
resultMap.put("message", message);
|
||||
|
||||
System.out.println("@@@@@@@@@@e배움터API성공@@@@@@@@@");
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
resultMap.put("resultCode", "-1");
|
||||
resultMap.put("message", e.getMessage());
|
||||
System.out.println("@@@@@@@@@@e배움터API실패@@@@@@@@@");
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
@ -211,21 +221,27 @@ public class APILoginContoller {
|
||||
*/
|
||||
@RequestMapping(value = "/web/chkloginKeyForEEdu.do", method = RequestMethod.POST)
|
||||
public ResponseEntity<Map<String, String>> loginKeytoOffedu(@RequestBody LoginVO loginVO) throws Exception{
|
||||
System.out.println("@@@@@@@@@찾교API시작 ID:"+loginVO.getUser_id()+"key:"+loginVO.getKey()+"@@@@@@@@@@");
|
||||
Map<String, String> response = new HashMap<>();
|
||||
try {
|
||||
loginVO = loginService.selectOffeduMberChk(loginVO);
|
||||
System.out.println("@@@찾교api - ID :"+loginVO.getId()+"key:"+loginVO.getKey());
|
||||
if(loginVO != null) {
|
||||
response.put("result_code", "1");
|
||||
response.put("message", "");
|
||||
}else {
|
||||
response.put("result_code", "-1");
|
||||
response.put("message", "인증오류입니다.");
|
||||
response.put("message", "인증오류입니다.");
|
||||
}
|
||||
//찾교 mber_seq key 값 파기
|
||||
System.out.println("@@@@@찾교 key 파기@@@@@@@@@@");
|
||||
loginService.updateMberSeqKeyNull(loginVO);
|
||||
return ResponseEntity.ok(response);
|
||||
}catch (Exception e) {
|
||||
response.put("result_code", "error");
|
||||
response.put("message", "Internal Server Error: " + e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
|
||||
return ResponseEntity.ok(response);
|
||||
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,10 +257,12 @@ public class APILoginContoller {
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView();
|
||||
modelAndView.setViewName("jsonView");
|
||||
|
||||
System.out.println("@@@@@@@@@찾교 @@@@@@@@@");
|
||||
//로그인 권한정보 불러오기
|
||||
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null;
|
||||
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
|
||||
System.out.println("@@@@@@@@키갱신ID:"+userId+"@@@@@@@@@@@@");
|
||||
System.out.println("@@@@@@@@키갱신VO:"+loginVO+"@@@@@@@@@@@@");
|
||||
if(loginVO == null) { //비 로그인 상태 일 시 파라미터 없이 e-배움터로 이동
|
||||
modelAndView.addObject("status", "loginN");
|
||||
return modelAndView;
|
||||
@ -254,6 +272,7 @@ public class APILoginContoller {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSS");
|
||||
String key = now.format(formatter);
|
||||
System.out.println("@@@@@@@@키:"+key+"@@@@@@@@@@@@");
|
||||
loginVO.setMberSeq(key);
|
||||
loginService.updateMberSeqKeyAjax(loginVO);
|
||||
modelAndView.addObject("status", "loginY");
|
||||
|
||||
@ -691,7 +691,7 @@ public class EgovLoginController {
|
||||
|
||||
SsoLoginVO ssologinVO = new SsoLoginVO();
|
||||
|
||||
if (ProfileUtil.isLocal() && "Y".equals(loginVO.getIsSelect())) { //비 sso login
|
||||
if ((ProfileUtil.isLocal() || ProfileUtil.isTLocal()) && "Y".equals(loginVO.getIsSelect())) { //비 sso login
|
||||
|
||||
loginVO.setPassword("1");
|
||||
loginVO.setStatusAll("N");
|
||||
|
||||
@ -217,7 +217,7 @@ public class MainController {
|
||||
private String pwFindUrl_Global;
|
||||
|
||||
/** 구동 환경 */
|
||||
@Value("#{globalSettings['Globals.prod.islocal']}")
|
||||
@Value("#{property['Globals.prod.islocal']}")
|
||||
private String environment;
|
||||
|
||||
@RequestMapping(value = "/{siteId}/web/main/mainPage_keri.do")
|
||||
|
||||
@ -423,11 +423,11 @@
|
||||
</select>
|
||||
<select id="loginDAO.selectOffeduMberChk" resultClass="loginVO">
|
||||
/* 임시.*NOT_SQL_LOG.* loginDAO.selectOffeduMberChk */
|
||||
SELECT mber_id AS id
|
||||
, ESNTL_ID AS uniqId
|
||||
SELECT mber_id AS user_id
|
||||
, ESNTL_ID AS key
|
||||
FROM lettngnrlmber a
|
||||
WHERE mber_id = #user_id#
|
||||
AND ESNTL_ID = #key#
|
||||
AND mber_seq = #key#
|
||||
</select>
|
||||
|
||||
<update id="loginDAO.updateMberSeqKeyAjax" parameterClass="loginVO">
|
||||
@ -436,4 +436,11 @@
|
||||
SET mber_seq = #mberSeq#
|
||||
WHERE mber_id = #id#
|
||||
</update>
|
||||
|
||||
<update id="loginDAO.updateMberSeqKeyNull" parameterClass="loginVO">
|
||||
/* 임시.*NOT_SQL_LOG.* loginDAO.updateMberSeqKeyNull*/
|
||||
UPDATE LETTNGNRLMBER
|
||||
SET mber_seq = ''
|
||||
WHERE mber_id = #user_id#
|
||||
</update>
|
||||
</sqlMap>
|
||||
|
||||
@ -889,7 +889,6 @@
|
||||
mber_sttus,
|
||||
sbscrb_de,
|
||||
esntl_id,
|
||||
mber_seq,
|
||||
frst_regist_pnttm,
|
||||
last_updt_pnttm
|
||||
)
|
||||
@ -900,7 +899,6 @@
|
||||
#emplyrSttusCode#,
|
||||
SYSTIMESTAMP,
|
||||
#uniqId#,
|
||||
#uniqId#,
|
||||
SYSTIMESTAMP,
|
||||
SYSTIMESTAMP
|
||||
)
|
||||
|
||||
@ -130,13 +130,13 @@ function usrJoin(){
|
||||
cache: false,
|
||||
success: function (returnData, status) {
|
||||
if(returnData.status == 'loginY'){
|
||||
alert(returnData.user_id);
|
||||
alert(returnData.key);
|
||||
window.location.href = "http://223.255.205.7/user/main/main.do?user_id="+returnData.user_id+"&key="+returnData.key;
|
||||
|
||||
|
||||
} else if(returnData.status == 'fail') {
|
||||
alert("key 갱신 오류");
|
||||
} else if(returnData.status == 'loginN'){
|
||||
alert("로그인을 해주세요.")
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
@ -190,13 +190,13 @@ function usrJoin(){
|
||||
</c:if>
|
||||
<!-- dev -->
|
||||
<c:if test="${environment eq 'dev' }">
|
||||
<p class="login_info header_login_wrap"><a href="http://223.255.205.7/user/member/loginForm.do&eduOff=Y" class="header_login"><i></i>로그인</a></p> <!-- e-배움터 개발서버 -->
|
||||
<p class="login_info"><a href="http://223.255.205.7/user/usrservice/selectUserSeView.do&eduOff=Y" class="header_join" title="새창열림"><i></i>회원가입</a></p> <!-- e-배움터 개발서버 -->
|
||||
<p class="login_info header_login_wrap"><a href="http://223.255.205.7/user/member/loginForm.do?eduOff=Y" class="header_login"><i></i>로그인</a></p> <!-- e-배움터 개발서버 -->
|
||||
<p class="login_info"><a href="http://223.255.205.7/user/usrservice/selectUserSeView.do?eduOff=Y" class="header_join" title="새창열림"><i></i>회원가입</a></p> <!-- e-배움터 개발서버 -->
|
||||
</c:if>
|
||||
<!-- svr -->
|
||||
<c:if test="${environment eq 'svr' }">
|
||||
<p class="login_info header_login_wrap"><a href="https://edu-copyright.or.kr/user/member/loginForm.do&eduOff=Y" class="header_login"><i></i>로그인</a></p> <!-- e-배움터 운영서버 -->
|
||||
<p class="login_info"><a href="https://edu-copyright.or.kr/user/usrservice/selectUserSeView.do&eduOff=Y" class="header_join" title="새창열림"><i></i>회원가입</a></p> <!-- e-배움터 운영서버 -->
|
||||
<p class="login_info header_login_wrap"><a href="https://edu-copyright.or.kr/user/member/loginForm.do?eduOff=Y" class="header_login"><i></i>로그인</a></p> <!-- e-배움터 운영서버 -->
|
||||
<p class="login_info"><a href="https://edu-copyright.or.kr/user/usrservice/selectUserSeView.do?eduOff=Y" class="header_join" title="새창열림"><i></i>회원가입</a></p> <!-- e-배움터 운영서버 -->
|
||||
</c:if>
|
||||
|
||||
<div class="btn_util">
|
||||
@ -282,12 +282,12 @@ function usrJoin(){
|
||||
<button type="button" class="btn_mobile btn_join" onclick="javascript:usrJoin();" title="회원가입"></button>
|
||||
</c:if>
|
||||
<c:if test="${environment eq 'dev' }">
|
||||
<button type="button" class="btn_mobile btn_login" onclick="location.href='http://223.255.205.7/user/member/loginForm.do&eduOff=Y'" title="로그인"></button>
|
||||
<button type="button" class="btn_mobile btn_join" onclick="location.href='http://223.255.205.7/user/usrservice/selectUserSeView.do&eduOff=Y'" title="회원가입"></button>
|
||||
<button type="button" class="btn_mobile btn_login" onclick="location.href='http://223.255.205.7/user/member/loginForm.do?eduOff=Y'" title="로그인"></button>
|
||||
<button type="button" class="btn_mobile btn_join" onclick="location.href='http://223.255.205.7/user/usrservice/selectUserSeView.do?eduOff=Y'" title="회원가입"></button>
|
||||
</c:if>
|
||||
<c:if test="${environment eq 'svr' }">
|
||||
<button type="button" class="btn_mobile btn_login" onclick="location.href='https://edu-copyright.or.kr/user/member/loginForm.do&eduOff=Y'" title="로그인"></button>
|
||||
<button type="button" class="btn_mobile btn_join" onclick="location.href='https://edu-copyright.or.kr/user/usrservice/selectUserSeView.do&eduOff=Y'" title="회원가입"></button>
|
||||
<button type="button" class="btn_mobile btn_login" onclick="location.href='https://edu-copyright.or.kr/user/member/loginForm.do?eduOff=Y'" title="로그인"></button>
|
||||
<button type="button" class="btn_mobile btn_join" onclick="location.href='https://edu-copyright.or.kr/user/usrservice/selectUserSeView.do?eduOff=Y'" title="회원가입"></button>
|
||||
</c:if>
|
||||
</c:when>
|
||||
<c:when test="${!empty LoginVO and !empty ssoLoginVO}">
|
||||
|
||||
@ -102,9 +102,9 @@ function usrIdPassFind(choose){
|
||||
<input type="hidden" name="userSe" value="GNR" />
|
||||
<input type="hidden" id="id" name="id">
|
||||
<input type="hidden" id="password" name="password">
|
||||
<kc:profile value="local">
|
||||
<%-- <kc:profile value="local"> --%>
|
||||
<input type="hidden" id="isSelect" name="isSelect">
|
||||
</kc:profile>
|
||||
<%-- </kc:profile> --%>
|
||||
<!-- cont -->
|
||||
|
||||
<div class="cont_tit">
|
||||
@ -120,7 +120,7 @@ function usrIdPassFind(choose){
|
||||
<span>로그인</span>
|
||||
해주세요
|
||||
</p>
|
||||
<kc:profile value="local">
|
||||
<%-- <kc:profile value="local"> --%>
|
||||
개발자 아이디 선택 : <select id="devIdSelect" style="width: 400px; height: 30px;" onchange="login()">
|
||||
<option value="">로그인할 아이디를 선택해주세요.</option>
|
||||
|
||||
@ -183,7 +183,7 @@ function usrIdPassFind(choose){
|
||||
|
||||
</select>
|
||||
<br></br>
|
||||
</kc:profile>
|
||||
<%-- </kc:profile> --%>
|
||||
<div class="login_form">
|
||||
<label for="id_text" class="label">아이디 입력</label>
|
||||
<input type="text" id="id_text" placeholder="아이디를 입력해주세요">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user