forked from TrueCloudLab/distribution
Send WWW-Authenticate header for silly auth
Signed-off-by: Andy Goldstein <agoldste@redhat.com>
This commit is contained in:
parent
4ae9583092
commit
4b5af16fdc
2 changed files with 3 additions and 3 deletions
|
@ -82,7 +82,7 @@ func (ch *challenge) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
header = fmt.Sprintf("%s,scope=%q", header, ch.scope)
|
header = fmt.Sprintf("%s,scope=%q", header, ch.scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Authorization", header)
|
w.Header().Set("WWW-Authenticate", header)
|
||||||
w.WriteHeader(http.StatusUnauthorized)
|
w.WriteHeader(http.StatusUnauthorized)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,8 +188,8 @@ func TestNewApp(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedAuthHeader := "Bearer realm=\"realm-test\",service=\"service-test\""
|
expectedAuthHeader := "Bearer realm=\"realm-test\",service=\"service-test\""
|
||||||
if req.Header.Get("Authorization") != expectedAuthHeader {
|
if e, a := expectedAuthHeader, req.Header.Get("WWW-Authenticate"); e != a {
|
||||||
t.Fatalf("unexpected authorization header: %q != %q", req.Header.Get("Authorization"), expectedAuthHeader)
|
t.Fatalf("unexpected WWW-Authenticate header: %q != %q", e, a)
|
||||||
}
|
}
|
||||||
|
|
||||||
var errs v2.Errors
|
var errs v2.Errors
|
||||||
|
|
Loading…
Reference in a new issue