fix: 修复广场作品列表登录状态丢失问题 - 扩展可选认证路径包含/work/list和/work/categories
This commit is contained in:
@@ -127,9 +127,8 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
"/user/check",
|
||||
"/user/wx-login",
|
||||
"/user/refresh-token",
|
||||
// 公开接口 - 作品列表和分类
|
||||
"/work/list",
|
||||
"/work/categories",
|
||||
// 公开接口 - 作品相关(由JwtAuthInterceptor内部处理可选认证)
|
||||
// /work/list, /work/categories, /work/{id} 不在此排除,通过拦截器内部正则匹配实现可选认证
|
||||
// 分类和Banner
|
||||
"/category/**",
|
||||
"/banner/**",
|
||||
|
||||
@@ -22,8 +22,9 @@ public class JwtAuthInterceptor implements HandlerInterceptor {
|
||||
private final JwtUtil jwtUtil;
|
||||
|
||||
// 公开路径(可选认证:有token则解析,无token也放行)
|
||||
// 匹配: /work/list, /work/categories, /work/{数字ID}
|
||||
private static final java.util.regex.Pattern OPTIONAL_AUTH_PATTERN =
|
||||
java.util.regex.Pattern.compile("^/work/\\d+$");
|
||||
java.util.regex.Pattern.compile("^/work/(list|categories|\\d+)$");
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user