//package com.upsfj.sfjprojectbackend.interceptor;
//
//import com.upsfj.sfjprojectbackend.entity.user.AccountUser;
//import com.upsfj.sfjprojectbackend.mapper.UserMapper;
//import jakarta.annotation.Resource;
//import jakarta.servlet.http.HttpServletRequest;
//import jakarta.servlet.http.HttpServletResponse;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.context.SecurityContext;
//import org.springframework.security.core.context.SecurityContextHolder;
//import org.springframework.security.core.userdetails.User;
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.HandlerInterceptor;
//@Component
//public class AuthorizeInterceptor implements HandlerInterceptor{
//    @Resource
//    UserMapper mapper;
//
//
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
////        SecurityContext context = SecurityContextHolder.getContext();
////        Authentication authentication = context.getAuthentication();
//////        System.out.println(authentication.getPrincipal());
////        if (authentication.isAuthenticated()) {
////            User user = (User) authentication.getPrincipal();
////            String username = user.getUsername();
////            AccountUser accountUser = mapper.fingAccountUserByName(username);
////            request.getSession().setAttribute("account", accountUser);
////            return true;
////        }
////        return false;
//        return true;
//
//
//    }
//}
