@RequestMapping public ModelAndView mymenu( String parentCode, Map<String, Object> out, HttpServletRequest request) { if (parentCode == null) { parentCode = ""; } SessionUser sessionUser = getCachedUser(request); List<AuthMenu> list = AuthUtils.getInstance() .queryMenuByParent(parentCode, AuthConst.PROJECT_CODE, sessionUser.getAccount()); return printJson(list, out); }
@RequestMapping public ModelAndView checkuser( Map<String, Object> out, HttpServletRequest request, HttpServletResponse response, String account, String password) { SessionUser sessionUser = AuthUtils.getInstance() .validateUser( response, account, password, AuthConst.PROJECT_CODE, AuthConst.PROJECT_PASSWORD); ExtResult result = new ExtResult(); if (sessionUser != null) { setSessionUser(request, sessionUser); result.setSuccess(true); } else { result.setData("用户名或者密码写错了,检查下大小写是否都正确了,再试一次吧 :)"); } return printJson(result, out); }
@RequestMapping public ModelAndView logout( Map<String, Object> out, HttpServletRequest request, HttpServletResponse response) { AuthUtils.getInstance().logout(request, response, null); return new ModelAndView("redirect:login.htm"); }
public SessionUser getCachedUser(HttpServletRequest request) { return AuthUtils.getInstance().getSessionUser(request, null); }
public void cleanCachedSession(HttpServletRequest request) { AuthUtils.getInstance().clearnSessionUser(request, null); }
public void setSessionUser(HttpServletRequest request, SessionUser sessionUser) { AuthUtils.getInstance().setSessionUser(request, sessionUser, null); }