@RequestMapping(value = "", method = RequestMethod.GET) public ModelAndView doGet( @Nonnull final HttpServletRequest request, @Nonnull final HttpServletResponse response) { final Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null) { new SecurityContextLogoutHandler().logout(request, response, auth); } return new ModelAndView("login"); }
/** * 获得当前操作上下文 * * @return */ public static OperationContext getOperationContext() { OperationContext operationContext = (OperationContext) SecurityContextHolder.getContext().getAuthentication(); if (operationContext == null) { operationContext = newDaemonOperationContext(); setOperationContext(operationContext); } return operationContext; }
/** * 设置当前操作上下文 * * @param operationContext */ public static void setOperationContext(OperationContext operationContext) { SecurityContextHolder.getContext().setAuthentication(operationContext); }