Skip to content

Commit

Permalink
API calls authorized with HTTP header
Browse files Browse the repository at this point in the history
This mod allows API calls to be authorized with HTTP header
when ENABLE_REVERSE_PROXY_AUTHENTICATION is enabled. Without
it user authenticated by reverse proxy is able to access
gitea UI but not API which is inconsistent.

Author-Change-Id: IB#1107572
  • Loading branch information
pboguslawski committed Mar 18, 2021
1 parent 0a23079 commit dc952c0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions routers/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ func reqToken() func(ctx *context.APIContext) {
return
}
if ctx.IsSigned {
// Don't require token if already authenticated by reverse proxy.
if setting.Service.EnableReverseProxyAuth {
return
}
ctx.RequireCSRF()
return
}
Expand Down

0 comments on commit dc952c0

Please sign in to comment.