From JCFWiKi
[편집] 개요
- 현재 common module은 표준웹에서 로그인 하여 x-internet 전용창을 call하는 흐름
- 장단점
- 마이플렛폼 개발툴에서 Launch project로 실행해 볼 수 없음
- 어플리케이션 test 시 마이플렛폼 개발툴에서 개발한후 다시 web 브라우져를 통해 로그인해야하는 번거로움이 있음
- 표준웹에서 가졌던 JSESSIONID와 마이플렛폼 전용브라우져의 JSESSIONID가 다르므로 login이후 JSESSIONID을 client 레지스트리에 넣어주고 마이플렛폼 브라우져에서 JSESSIONID를 빼는 작업을 해야함.
- 마이플렛폼 로그인을 할 경우는 autocookie를 통해 서버단 jsessionid를 가져오므로 setReg,getReg할 필요 없음. 단지 JSESSIONID란 이름으로 share변수를 선언하기만 하면 됨
[편집] 마이플렛폼 개발툴에서 (PID) 로그인 하기
[편집] 마이플렛폼 용 startxml 추가 생성하여 pid에 프로젝트 등록
- dev_common_ci_main.xml 생성
- initurl="CommonGroup::login.xml" 로 교체
- OnBeforeExit="Common_Exit"를 삭제
- pid에 project manager에 dev_common_ci_main.xml로 등록
[편집] 마이플렛폼 로그인 화면
|
|
- 마이플렛폼의 option에서 autocokiee를 true로 하면(기본값 true) 자동으로 서버단의 쿠키값을 마이플렛폼의 global 변수로 가져옴
- share 변수로 JSESSIONID를 선언할 경우 자동으로 서버단의 sessionID가 JSESSIONID변수로 들어감
|
- auth/authResult.action 호출시 j_username과 j_password 를 파라미터로 가지고 감
function btnLogin_OnClick(obj)
{
var queryString = "";
queryString += "?j_username=" + edUserName.Text;
queryString += "&j_password=" + edPassword.Text;
GV_IS_DEV = true;
transaction(
"Login", //strServiceID
"Common::login/loginResult.action" + queryString, //strUrl
"", //arrParmeter
"",
"",// returnDataSet ID
"fn_LoginCallBack"); // fnCallback
}
function fn_LoginCallBack()
{
//마이플렛폼으로 로그인할 경우 jsessionID를 레지스트리에 넣어줄 필요가 없음
//alert(JSESSIONID);
//setReg("GlobalVal",JSESSIONID);
go("CommonGroup::MainFrame.xml");
}
[편집] loginAction
function btnLogin_OnClick(obj)
public void authResult() {
SecurityContext securityContext = SecurityContextHolder.getContext();
AuthenticationProcessingFilter authenticationProcessingFilter = (AuthenticationProcessingFilter)SpringContextHolder.getBean("authenticationProcessingFilter");
Authentication authentication = authenticationProcessingFilter.attemptAuthentication(getRequest());
if (authentication.isAuthenticated()){
securityContext.setAuthentication(authentication);
System.out.println(getRequest().getSession().getId());
//마이플렛폼에 autocookie값이 true일 경우에는 자동으로 마이플렛폼이 서버단 cookie값을 가져오기 때문에 Outchanel로 jsessionID를 넣어줄 필요가 없음
//OutChannel.setVariable("JSESSIONID", getRequest().getSession().getId());
//OutChannel.send();
}else{
OutChannel.error("-2000", "login fail");
}
}