| | |
| | | import com.xcong.excoin.modules.member.entity.MemberEntity; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.HttpRequest; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | |
| | | /** |
| | | * 登陆用户工具类 |
| | |
| | | return (String) SecurityContextHolder.getContext().getAuthentication().getCredentials(); |
| | | } |
| | | |
| | | public static void resetAppLoginUser(MemberEntity memberEntity) { |
| | | Authentication authentication = new UsernamePasswordAuthenticationToken(memberEntity, getAppLoginUserToken(), new ArrayList<>()); |
| | | SecurityContextHolder.getContext().setAuthentication(authentication); |
| | | } |
| | | |
| | | /** |
| | | * mybatis 拦截器专用 |
| | | * |