注册集成手机号登录,修改密码,修改手机号
This commit is contained in:
+29
-8
@@ -40,6 +40,13 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
|
||||
String path = request.getURI().getPath();
|
||||
|
||||
log.info("Gateway received request: {}", path);
|
||||
|
||||
// 打印白名单配置
|
||||
if (gatewayConfig.getWhitelist() != null) {
|
||||
log.info("Whitelist from config: {}", gatewayConfig.getWhitelist());
|
||||
} else {
|
||||
log.info("Whitelist from config is null");
|
||||
}
|
||||
|
||||
// 1. Whitelist check (login and register interfaces don't need authentication)
|
||||
log.info("Checking if path is in whitelist: {}", path);
|
||||
@@ -71,14 +78,28 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
|
||||
* 判断是否在白名单中
|
||||
*/
|
||||
private boolean isWhitelist(String path) {
|
||||
return path.equals("/api/user/login") ||
|
||||
path.equals("/api/user/register") ||
|
||||
path.equals("/api/user/refresh-token") ||
|
||||
path.equals("/api/shop/list/simple") ||
|
||||
path.equals("/api/admin/auth/login") ||
|
||||
path.equals("/admin/api/auth/login") ||
|
||||
path.startsWith("/api/user/get/account") ||
|
||||
path.startsWith("/api/health");
|
||||
// 首先检查配置文件中的白名单
|
||||
if (gatewayConfig.getWhitelist() != null) {
|
||||
for (String whitelistPath : gatewayConfig.getWhitelist()) {
|
||||
if (pathMatcher.match(whitelistPath, path)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 硬编码白名单作为备用
|
||||
return pathMatcher.match("/api/user/login", path) ||
|
||||
pathMatcher.match("/api/user/register", path) ||
|
||||
pathMatcher.match("/api/user/refresh-token", path) ||
|
||||
pathMatcher.match("/api/user/send-verification-code", path) ||
|
||||
pathMatcher.match("/api/user/phone-login", path) ||
|
||||
pathMatcher.match("/api/user/get/account/**", path) ||
|
||||
pathMatcher.match("/api/shop/list/simple", path) ||
|
||||
pathMatcher.match("/api/admin/auth/login", path) ||
|
||||
pathMatcher.match("/admin/api/auth/login", path) ||
|
||||
pathMatcher.match("/api/health/**", path) ||
|
||||
pathMatcher.match("/api/error", path) ||
|
||||
pathMatcher.match("/api/admin/object-storage-file/upload", path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,4 +75,4 @@ spring:
|
||||
predicates:
|
||||
- Path=/admin/api/**
|
||||
filters:
|
||||
- RewritePath=/admin/api/(?<remaining>.*), /admin/${remaining}
|
||||
- RewritePath=/admin/api/(?<remaining>.*), /admin/${remaining}
|
||||
@@ -32,3 +32,6 @@ spring:
|
||||
- data-id: mybatis-plus.yaml
|
||||
group: DEFAULT_GROUP
|
||||
refresh: true
|
||||
- data-id: redis.yaml
|
||||
group: DEFAULT_GROUP
|
||||
refresh: true
|
||||
|
||||
Reference in New Issue
Block a user