Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ReverseProxyAuth API authorization fixed
Related: #15119 (comment)
Author-Change-Id: IB#1107572
  • Loading branch information
pboguslawski committed Jun 25, 2021
commit d23ef1bf8c5f8130e56185c46b747a9381f784f2
11 changes: 3 additions & 8 deletions routers/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,10 @@ func reqExploreSignIn() func(ctx *context.APIContext) {

func reqBasicOrRevProxyAuth() func(ctx *context.APIContext) {
return func(ctx *context.APIContext) {
authorized := false
if ctx.IsSigned {
if ctx.Context.IsBasicAuth {
authorized = true
} else if setting.Service.EnableReverseProxyAuth && ctx.Data["AuthedMethod"].(string) == new(auth.ReverseProxy).Name() {
authorized = true
}
if ctx.IsSigned && setting.Service.EnableReverseProxyAuth && ctx.Data["AuthedMethod"].(string) == new(auth.ReverseProxy).Name() {
return
}
if !authorized {
if !ctx.Context.IsBasicAuth {
ctx.Error(http.StatusUnauthorized, "reqBasicOrRevProxyAuth", "auth required")
return
}
Expand Down