Use OPA Server caller identity in OPA policy #518
-
I am currently setting up Bearer token authentication on an OPA server as documented in https://www.openpolicyagent.org/docs/latest/security/#authentication-and-authorization I created a specific policy to manage authorization on OPA server using Now I am wondering how I can obtain the JWT or some JWT claims in a policy (apart from the Is this currently possible? Or should I explicitly re-add those claims as an input for my custom policy and check the coherence with the input JWT in the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @HenriBlacksmith 👋 Yes, the authorization header token would be presented for access to the OPA API itself, while attributes carried in |
Beta Was this translation helpful? Give feedback.
That's correct. Propagating data from the request context assumes that there is a request context, and not making such an assumption allows the same policy to be evaluated in any context and by any tool available in the OPA toolchain or even ecosystem, like
opa test
,opa eval
,opa bench
,opa exec
, and so on.I suppose an authorization policy could be made to work so that it was allowed to contribute data to the
input
object of the regular policy evaluation, but I'm not entirely sure what that would look like.