fix(http): set the authorizer on the context in proxy query handler (#12605)

pull/12637/head
Jonathan A. Sternberg 2019-03-14 10:19:47 -05:00 committed by GitHub
parent a8b9f5d803
commit 1d996630b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -4,12 +4,14 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"github.com/influxdata/flux"
"github.com/influxdata/flux/iocounter"
influxdbcontext "github.com/influxdata/influxdb/context"
"github.com/influxdata/influxdb/kit/tracing"
"github.com/influxdata/influxdb/query"
"github.com/julienschmidt/httprouter"
@ -69,6 +71,11 @@ func (h *ProxyQueryHandler) handlePostQuery(w http.ResponseWriter, r *http.Reque
EncodeError(ctx, err, w)
return
}
if req.Request.Authorization == nil {
EncodeError(ctx, errors.New("authorization is missing in the query request"), w)
return
}
ctx = influxdbcontext.SetAuthorizer(ctx, req.Request.Authorization)
w.Header().Set("Trailer", QueryStatsTrailer)