Spring Security 获取登入用户

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

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

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

你可能感兴趣的:(javaee)