Merge pull request #736 from stevvooe/authorization-interface-cleanup

Authorization interface cleanup
This commit is contained in:
Stephen Day 2015-07-24 15:39:49 -07:00
commit a6ef6c0dc3
7 changed files with 36 additions and 38 deletions

View file

@ -518,7 +518,7 @@ func (app *App) authorized(w http.ResponseWriter, r *http.Request, context *Cont
switch err := err.(type) {
case auth.Challenge:
// Add the appropriate WWW-Auth header
err.ServeHTTP(w, r)
err.SetHeaders(w)
if err := errcode.ServeJSON(w, v2.ErrorCodeUnauthorized.WithDetail(accessRecords)); err != nil {
ctxu.GetLogger(context).Errorf("error serving error json: %v (from %v)", err, context.Errors)