Spring Security 获取登入用户

     SecurityContext sc = SecurityContextHolder.getContext();
      Authentication auth = sc.getAuthentication();

      // 登入用户信息
      User user = (User) auth.getPrincipal();

      log.info("用户userName[{}]",user.getName());

猜你喜欢

转载自lxl012020.iteye.com/blog/2083397