From adaf11f26dcf73aa111f8f7fc56243e07640383b Mon Sep 17 00:00:00 2001 From: Brandon Farmer Date: Tue, 15 Jan 2019 14:01:05 -0800 Subject: [PATCH] Use JWT in enterprise for authentication --- server/flux.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server/flux.go b/server/flux.go index 75b9a47f3..5c9c12167 100644 --- a/server/flux.go +++ b/server/flux.go @@ -11,6 +11,7 @@ import ( "time" "github.com/bouk/httprouter" + "github.com/influxdata/chronograf/influx" "github.com/influxdata/flux/ast" _ "github.com/influxdata/flux/builtin" "github.com/influxdata/flux/complete" @@ -174,11 +175,9 @@ func (s *Service) ProxyFlux(w http.ResponseWriter, r *http.Request) { req.Host = u.Host req.URL = u - // Because we are acting as a proxy, flux needs to have the basic auth information set as - // a header directly - if src.Username != "" && src.Password != "" { - req.SetBasicAuth(src.Username, src.Password) - } + // Use authorization method based on whether it is OSS or Enterprise + auth := influx.DefaultAuthorization(&src) + auth.Set(req) } // TODO: this was copied from services we may not needs this?