You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would often be useful, to evaluate an authorization policy, to inspect the body of the request and make assertions against certain fields' values.
Adding a body element to the OPA request (the relevant code is in the OpaReactiveAuthorizationManager class) is not as straightforward as it would appear.
There are a couple of issues:
the size of the request's body contents may be fairly large, multi-part, or even a full binary file upload;
converting arbitrary content to JSON in a way that could be evaluated in a Rego policy is not trivial.
While the former problem could be solved naively (just ignore any request whose Content-Length is greater than a given, configurable threshold) and the latter could be left as a "problem for the reader" (in this case, the Rego policy author(s)), we choose here a different approach:
we add a body element (object) to the TokenBasedAuthorizationRequest if the ContentType is application/json;
It would often be useful, to evaluate an authorization policy, to inspect the body of the request and make assertions against certain fields' values.
Adding a
body
element to the OPA request (the relevant code is in theOpaReactiveAuthorizationManager
class) is not as straightforward as it would appear.There are a couple of issues:
While the former problem could be solved naively (just ignore any request whose
Content-Length
is greater than a given, configurable threshold) and the latter could be left as a "problem for the reader" (in this case, the Rego policy author(s)), we choose here a different approach:body
element (object) to theTokenBasedAuthorizationRequest
if theContentType
isapplication/json
;body
string ifContentType
istext/*
;ContentType
will be added to theheaders
section (see Add request Headers to OPA authorization request #36).The text was updated successfully, but these errors were encountered: