| | |
| | | public class SecurityUtils { |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * 获取当前登录用户信息 |
| | | */ |
| | | private static UserDetails getUserDetails() { |
| | | final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取系统用户名称 登录名 |
| | | * 获取当前登录用户登录名 |
| | | * |
| | | * @return 系统用户名称 |
| | | * @return 当前登录用户登录名 |
| | | */ |
| | | public static String getUsername() { |
| | | final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取系统用户id |
| | | * 获取当前登录账号的id |
| | | * |
| | | * @return 系统用户id |
| | | * @return 当前登录账号的id |
| | | */ |
| | | public static Long getUserId() { |
| | | SecurityProperties properties = SpringContextHolder.getBean(SecurityProperties.class); |