|
|
|
@ -83,6 +83,18 @@ func HTTP(ctx *context.Context) { |
|
|
|
|
|
|
|
|
|
// check access
|
|
|
|
|
if askAuth { |
|
|
|
|
if setting.Service.EnableReverseProxyAuth { |
|
|
|
|
authUsername = ctx.Req.Header.Get(setting.ReverseProxyAuthUser) |
|
|
|
|
if len(authUsername) == 0 { |
|
|
|
|
ctx.HandleText(401, "reverse proxy login error. authUsername empty") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
authUser, err = models.GetUserByName(authUsername) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.HandleText(401, "reverse proxy login error, got error while running GetUserByName") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
authHead := ctx.Req.Header.Get("Authorization") |
|
|
|
|
if len(authHead) == 0 { |
|
|
|
|
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=\".\"") |
|
|
|
@ -165,6 +177,7 @@ func HTTP(ctx *context.Context) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
callback := func(rpc string, input []byte) { |
|
|
|
|
if rpc != "receive-pack" || isWiki { |
|
|
|
|