From 4b5af16fdc2e7cfe8d2364e033164b710d8482fa Mon Sep 17 00:00:00 2001 From: Andy Goldstein Date: Wed, 11 Mar 2015 15:10:49 -0400 Subject: [PATCH] Send WWW-Authenticate header for silly auth Signed-off-by: Andy Goldstein --- docs/auth/silly/access.go | 2 +- docs/handlers/app_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/auth/silly/access.go b/docs/auth/silly/access.go index 20448efd..134b0ae5 100644 --- a/docs/auth/silly/access.go +++ b/docs/auth/silly/access.go @@ -82,7 +82,7 @@ func (ch *challenge) ServeHTTP(w http.ResponseWriter, r *http.Request) { header = fmt.Sprintf("%s,scope=%q", header, ch.scope) } - w.Header().Set("Authorization", header) + w.Header().Set("WWW-Authenticate", header) w.WriteHeader(http.StatusUnauthorized) } diff --git a/docs/handlers/app_test.go b/docs/handlers/app_test.go index 80f92490..cd515dd0 100644 --- a/docs/handlers/app_test.go +++ b/docs/handlers/app_test.go @@ -188,8 +188,8 @@ func TestNewApp(t *testing.T) { } expectedAuthHeader := "Bearer realm=\"realm-test\",service=\"service-test\"" - if req.Header.Get("Authorization") != expectedAuthHeader { - t.Fatalf("unexpected authorization header: %q != %q", req.Header.Get("Authorization"), expectedAuthHeader) + if e, a := expectedAuthHeader, req.Header.Get("WWW-Authenticate"); e != a { + t.Fatalf("unexpected WWW-Authenticate header: %q != %q", e, a) } var errs v2.Errors