青岛即墨网站建设设计,汕头企业网站建站模板,合肥集团网站建设,台江网站建设方法一#xff08;springSecurity自带的#xff09; AuthenticationPrincipal 是 Spring Security 框架中的一个注解#xff0c;用于获取当前已认证用户的 principal#xff08;即用户身份信息#xff09;。 方法二#xff08;若依项目自带的#xff09; #xff08;1…方法一springSecurity自带的 AuthenticationPrincipal 是 Spring Security 框架中的一个注解用于获取当前已认证用户的 principal即用户身份信息。 方法二若依项目自带的 1方法1.1
import com.ruoyi.common.security.service.TokenService;AutowiredTokenService tokenService;//用户信息LoginUser loginUser tokenService.getLoginUser();securityUtil.logInAs( loginUser.getUsername());2方法1.12 SecurityContextHolder.getContext().getAuthentication().getName()