package kr.co.jinwoosi.clfd.framework.security.web;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import kr.co.jinwoosi.clfd.framework.security.model.User;
import kr.co.jinwoosi.clfd.framework.security.service.UserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import kr.co.jinwoosi.clfd.framework.base.web.BaseController;

public class SessonCheckController extends BaseController{

	@Resource (name="userService")
	private UserService userService;
	
	@RequestMapping (value="/system/login/sessionCheck.mng", method=RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> sessionCheck(HttpServletRequest request){
		Map<String, Object> result = new HashMap<String, Object>();
		try{
			HttpSession session = request.getSession();
			User user = (User) session.getAttribute("user");
			
			if(user == null){
				result.put("result","sessionOut");
			}else{
				result.put("result","sessionIn");
			}
			
		}catch (Exception e){
			
		}
		return result;
	}
	
}
