pkg: authorization: add Err to tweak response status code
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
16870807fe
commit
16d022c482
3 changed files with 42 additions and 1 deletions
|
@ -84,6 +84,10 @@ func (a *Ctx) AuthZRequest(w http.ResponseWriter, r *http.Request) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if authRes.Err != "" {
|
||||
return fmt.Errorf(authRes.Err)
|
||||
}
|
||||
|
||||
if !authRes.Allow {
|
||||
return fmt.Errorf(authRes.Msg)
|
||||
}
|
||||
|
@ -107,6 +111,10 @@ func (a *Ctx) AuthZResponse(rm ResponseModifier, r *http.Request) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if authRes.Err != "" {
|
||||
return fmt.Errorf(authRes.Err)
|
||||
}
|
||||
|
||||
if !authRes.Allow {
|
||||
return fmt.Errorf(authRes.Msg)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue