From 94dbca0006bc50493af8b7f61c99b9bac1ea9ada Mon Sep 17 00:00:00 2001 From: Umputun Date: Thu, 22 Feb 2018 13:21:01 -0600 Subject: [PATCH] don't retrun ww-auth header --- app/rest/auth/auth.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/rest/auth/auth.go b/app/rest/auth/auth.go index 5fb88267..f2aff163 100644 --- a/app/rest/auth/auth.go +++ b/app/rest/auth/auth.go @@ -37,7 +37,7 @@ func (a *Authenticator) Auth(reqAuth bool) func(http.Handler) http.Handler { f := func(h http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { - if a.basicDevUser(w, r, reqAuth) { // fail-back to dev user if enabled + if a.basicDevUser(w, r) { // fail-back to dev user if enabled user := devUser ctx := r.Context() ctx = context.WithValue(ctx, rest.ContextKey("user"), user) @@ -103,16 +103,12 @@ func (a *Authenticator) AdminOnly(next http.Handler) http.Handler { return http.HandlerFunc(fn) } -func (a *Authenticator) basicDevUser(w http.ResponseWriter, r *http.Request, reqAuth bool) bool { +func (a *Authenticator) basicDevUser(w http.ResponseWriter, r *http.Request) bool { if a.DevPasswd == "" || !a.DevEnabled { return false } - if reqAuth { - w.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`) - } - s := strings.SplitN(r.Header.Get("Authorization"), " ", 2) if len(s) != 2 { return false