public class SecurityUtils{

    public static Authentication getActiveAuthentication(){
        return SecurityContextHolder.getContext().getAuthentication();
    }

    /**
     * 获取当前用户
     */
    public static User getActiveUser() {
        return (User) getActiveAuthentication().getPrincipal();
    }

    public static String getActiveAccount(){
        return getActiveUser().getUsername();
    }
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
  • 2021-10-22
  • 2022-02-10
  • 2021-07-24
猜你喜欢
  • 2021-09-28
  • 2021-08-12
  • 2022-12-23
  • 2021-10-10
  • 2021-07-20
相关资源
相似解决方案