1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #27267 from ezrasilvera/plugin_fix

Call the AuthZRes function also when the daemon  returns error
This commit is contained in:
Sebastiaan van Stijn 2016-10-18 21:53:43 -07:00 committed by GitHub
commit 194f04bbbe

View file

@ -64,15 +64,21 @@ func (m *Middleware) WrapHandler(handler func(ctx context.Context, w http.Respon
rw := NewResponseModifier(w)
if err := handler(ctx, rw, r, vars); err != nil {
logrus.Errorf("Handler for %s %s returned error: %s", r.Method, r.RequestURI, err)
return err
var errD error
if errD = handler(ctx, rw, r, vars); errD != nil {
logrus.Errorf("Handler for %s %s returned error: %s", r.Method, r.RequestURI, errD)
}
if err := authCtx.AuthZResponse(rw, r); err != nil {
if err := authCtx.AuthZResponse(rw, r); errD == nil && err != nil {
logrus.Errorf("AuthZResponse for %s %s returned error: %s", r.Method, r.RequestURI, err)
return err
}
if errD != nil {
return errD
}
return nil
}
}