세션 탈취 검사하기

Agent에서 AuthCheck 클래스를 이용해 인증 체크를 하고 그 결과가 AuthStatus.SSOSuccess 일 때 사용자의 세션 탈취 여부를 조사하는 메서드를 실행합니다.

이 메서드는 필요한 페이지에서만 호출합니다. Json data를 이용하는 로직이 있으므로 Ajax의 결과 페이지에서는 사용하지 않아야 합니다.

[HomeController.cs 의 Index 메서드 중 일부]

public ActionResult Index()
{
	try
	{
		HomeIndexViewModel model = new HomeIndexViewModel();
		AuthCheck authCheck = new AuthCheck(Request, Response);
		AuthStatus status = authCheck.CheckLogon();

		if (status == AuthStatus.SSOSuccess)
		{
			authCheck.CheckHijacking();
		}
		return View(model);
	}
	catch(AgentException agentException)
	{
		HomeIndexViewModel errModel = new HomeIndexViewModel();
		errModel.ErrorCode = agentException.ExceptionCode.ToString();
		return View(errModel);				
	}			
}

Last updated

Was this helpful?