|
@@ -68,7 +68,8 @@ public class JwtInterceptor implements HandlerInterceptor {
|
|
|
|
|
|
|
|
// 必须登录才能访问的路径:anonymous 访问直接 401(这些接口消耗微信配额/写数据/扣积分)
|
|
// 必须登录才能访问的路径:anonymous 访问直接 401(这些接口消耗微信配额/写数据/扣积分)
|
|
|
private static final String[] LOGIN_REQUIRED_PATHS = {
|
|
private static final String[] LOGIN_REQUIRED_PATHS = {
|
|
|
- "/api/share/qrcode" // 生成海报小程序码:anonymous 会反复触发微信 access_token 失效("not latest")
|
|
|
|
|
|
|
+ "/api/share/qrcode", // 生成海报小程序码:anonymous 会反复触发微信 access_token 失效("not latest")
|
|
|
|
|
+ "/api/auth/verify-password" // 密码验证:属凭证操作,必须登录(防 /api/auth/verify 前缀碰撞白名单放行)
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -80,7 +81,9 @@ public class JwtInterceptor implements HandlerInterceptor {
|
|
|
|
|
|
|
|
String path = request.getRequestURI();
|
|
String path = request.getRequestURI();
|
|
|
for (String publicPath : PUBLIC_PATHS) {
|
|
for (String publicPath : PUBLIC_PATHS) {
|
|
|
- if (path.equals(publicPath) || path.startsWith(publicPath)) {
|
|
|
|
|
|
|
+ String boundaryPath = publicPath.endsWith("/**")
|
|
|
|
|
+ ? publicPath.substring(0, publicPath.length() - 3) : publicPath;
|
|
|
|
|
+ if (path.equals(publicPath) || path.startsWith(boundaryPath + "/")) {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|