提交 cbf4d14d 编写于 作者: 喷火的神灵's avatar 喷火的神灵 🎱

2023年6月10日18:01:19

上级 7061f5ac
......@@ -13,6 +13,13 @@ import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
/**
* 定义了一个拦截器,用于在请求处理之前,
* 从SecurityContext中获取当前登录的用户信息,
* 并从数据库中查询用户的账户信息,
* 然后将其存储在session中,
* 以便后续的使用。
*/
@Component
public class AuthorizeInterceptor implements HandlerInterceptor {
@Autowired
......
......@@ -15,6 +15,7 @@ import java.util.Set;
*
* @author 赵錾
* @date 2023年6月7日14:10:08
* 弃用
*/
@Data
public class CustomUserDetails implements UserDetails {
......
......@@ -5,6 +5,11 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 配置了一个WebMvcConfigurer,
* 用于注册拦截器,并指定拦截器的匹配路径和排除路径。
* 这里表示拦截所有的请求,除了/api/auth/**开头的请求。
*/
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册