fix: Proxy auth check

This commit is contained in:
tbphp
2025-07-16 16:06:42 +08:00
parent c66b0a7b9d
commit 25bebe8bc5

View File

@@ -136,11 +136,6 @@ func Auth(
if strings.HasPrefix(path, "/api") { if strings.HasPrefix(path, "/api") {
// Handle backend API authentication // Handle backend API authentication
key = extractBearerKey(c) key = extractBearerKey(c)
if key == "" || key != authConfig.Key {
response.Error(c, app_errors.ErrUnauthorized)
c.Abort()
return
}
} else if strings.HasPrefix(path, "/proxy/") { } else if strings.HasPrefix(path, "/proxy/") {
// Handle proxy authentication // Handle proxy authentication
key, err = extractProxyKey(c, groupManager, channelFactory) key, err = extractProxyKey(c, groupManager, channelFactory)
@@ -161,7 +156,7 @@ func Auth(
return return
} }
if key == "" { if key == "" || key != authConfig.Key {
response.Error(c, app_errors.ErrUnauthorized) response.Error(c, app_errors.ErrUnauthorized)
c.Abort() c.Abort()
return return