mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
[break] change auth config & add auth key
This commit is contained in:
parent
978ece6fa0
commit
395f641468
8 changed files with 50 additions and 27 deletions
|
|
@ -12,7 +12,7 @@ func AuthPassThrough(c *app.RequestContext, cfg *config.Config, req *http.Reques
|
|||
token := c.Query("token")
|
||||
if token != "" {
|
||||
logDebug("%s %s %s %s %s Auth-PassThrough: token %s", c.ClientIP(), c.Method(), string(c.Path()), c.UserAgent(), c.Request.Header.GetProtocol(), token)
|
||||
switch cfg.Auth.AuthMethod {
|
||||
switch cfg.Auth.Method {
|
||||
case "parameters":
|
||||
if !cfg.Auth.Enabled {
|
||||
req.Header.Set("Authorization", "token "+token)
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ func Matcher(rawPath string, cfg *config.Config) (string, string, string, error)
|
|||
user = parts[1]
|
||||
}
|
||||
if !cfg.Auth.ForceAllowApi {
|
||||
if cfg.Auth.AuthMethod != "header" || !cfg.Auth.Enabled {
|
||||
if cfg.Auth.Method != "header" || !cfg.Auth.Enabled {
|
||||
return "", "", "", ErrAuthHeaderUnavailable
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue