Skip to content

Commit

Permalink
Make reverse proxy auth optional (#4643)
Browse files Browse the repository at this point in the history
* Make reverse proxy auth optional

If the option ENABLE_REVERSE_PROXY_AUTHENTICATION is enabled, make
reverse proxy auth optional, instead of failing if the authentication
did not succeed.

Fixes #3973

Signed-off-by: Najib Idrissi <najib.idrissi.kaitouni@gmail.com>

* Update http.go
  • Loading branch information
Najib Idrissi authored and techknowlogick committed Aug 29, 2018
1 parent fcea868 commit b9ae16d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions routers/repo/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,8 @@ 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
}
authUsername = ctx.Req.Header.Get(setting.ReverseProxyAuthUser)
if setting.Service.EnableReverseProxyAuth && len(authUsername) > 0 {
authUser, err = models.GetUserByName(authUsername)
if err != nil {
ctx.HandleText(401, "reverse proxy login error, got error while running GetUserByName")
Expand Down

0 comments on commit b9ae16d

Please sign in to comment.