Merge pull request #27267 from ezrasilvera/plugin_fix
Call the AuthZRes function also when the daemon returns error
This commit is contained in:
commit
194f04bbbe
1 changed files with 10 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue