Call the AuthZRes function also when the daemon returns error
Signed-off-by: Ezra Silvera <ezra@il.ibm.com>
This commit is contained in:
parent
9115b65ffd
commit
5a8ff40254
1 changed files with 10 additions and 4 deletions
|
@ -55,15 +55,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