mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 08:11:11 +08:00
25w01e
This commit is contained in:
parent
972baee564
commit
a0e5846e11
3 changed files with 24 additions and 17 deletions
|
|
@ -1,5 +1,10 @@
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
25w01e
|
||||||
|
---
|
||||||
|
- PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用
|
||||||
|
- FIX: 修复引入token参数透传功能导致的一些问题
|
||||||
|
|
||||||
25w01d
|
25w01d
|
||||||
---
|
---
|
||||||
- PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用
|
- PRE-RELEASE: 此版本是v1.8.0的预发布版本,请勿在生产环境中使用
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
25w01d
|
25w01e
|
||||||
|
|
@ -281,25 +281,27 @@ func setRequestHeaders(c *gin.Context, req *req.Request) {
|
||||||
func authPassThrough(c *gin.Context, cfg *config.Config, req *req.Request) {
|
func authPassThrough(c *gin.Context, cfg *config.Config, req *req.Request) {
|
||||||
if cfg.Auth.PassThrough {
|
if cfg.Auth.PassThrough {
|
||||||
token := c.Query("token")
|
token := c.Query("token")
|
||||||
switch cfg.Auth.AuthMethod {
|
if token != "" {
|
||||||
case "parameters":
|
switch cfg.Auth.AuthMethod {
|
||||||
if !cfg.Auth.Enabled {
|
case "parameters":
|
||||||
req.SetHeader("Authorization", "token "+token)
|
if !cfg.Auth.Enabled {
|
||||||
} else {
|
req.SetHeader("Authorization", "token "+token)
|
||||||
logWarning("%s %s %s %s %s Auth-Error: Conflict Auth Method", c.ClientIP(), c.Request.Method, c.Request.URL.String(), c.Request.Header.Get("User-Agent"), c.Request.Proto)
|
} else {
|
||||||
|
logWarning("%s %s %s %s %s Auth-Error: Conflict Auth Method", c.ClientIP(), c.Request.Method, c.Request.URL.String(), c.Request.Header.Get("User-Agent"), c.Request.Proto)
|
||||||
|
// 500 Internal Server Error
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"error": "Conflict Auth Method"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
case "header":
|
||||||
|
if cfg.Auth.Enabled {
|
||||||
|
req.SetHeader("Authorization", "token "+token)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
logWarning("%s %s %s %s %s Invalid Auth Method / Auth Method is not be set", c.ClientIP(), c.Request.Method, c.Request.URL.String(), c.Request.Header.Get("User-Agent"), c.Request.Proto)
|
||||||
// 500 Internal Server Error
|
// 500 Internal Server Error
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Conflict Auth Method"})
|
c.JSON(http.StatusInternalServerError, gin.H{"error": "Invalid Auth Method / Auth Method is not be set"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "header":
|
|
||||||
if cfg.Auth.Enabled {
|
|
||||||
req.SetHeader("Authorization", "token "+token)
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
logWarning("%s %s %s %s %s Invalid Auth Method / Auth Method is not be set", c.ClientIP(), c.Request.Method, c.Request.URL.String(), c.Request.Header.Get("User-Agent"), c.Request.Proto)
|
|
||||||
// 500 Internal Server Error
|
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Invalid Auth Method / Auth Method is not be set"})
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue