@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");
 }
예제 #2
0
 /**
  * 获得当前操作上下文
  *
  * @return
  */
 public static OperationContext getOperationContext() {
   OperationContext operationContext =
       (OperationContext) SecurityContextHolder.getContext().getAuthentication();
   if (operationContext == null) {
     operationContext = newDaemonOperationContext();
     setOperationContext(operationContext);
   }
   return operationContext;
 }
예제 #3
0
 /**
  * 设置当前操作上下文
  *
  * @param operationContext
  */
 public static void setOperationContext(OperationContext operationContext) {
   SecurityContextHolder.getContext().setAuthentication(operationContext);
 }