Accept simpler response from OPA (#7637)

master
Krishna Srinivas 6 years ago committed by Nitish Tiwari
parent 3eb7a8bde8
commit 502456db91
  1. 6
      pkg/iam/policy/opa.go

@ -123,14 +123,12 @@ func (o *Opa) IsAllowed(args Args) bool {
// Handle OPA response
type opaResponse struct {
Result struct {
Allow bool `json:"allow"`
} `json:"result"`
Allow bool `json:"allow"`
}
var result opaResponse
if err = json.NewDecoder(resp.Body).Decode(&result); err != nil {
return false
}
return result.Result.Allow
return result.Allow
}

Loading…
Cancel
Save