模拟建设网站,网站制作培训多少钱,取名网站开发,wordpress theauthor方法一#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()