Authorization decision based upon the folder a resource resides in. #517
-
We are in the process of evaluating a switch from an in-house developed authorization service to Open Policy Agent. Our in-house authorization service supports the concept of authorizing a request to a particular uri based on the folder that the requesting uri is member of. In our case a folder, is a logical construct, supported by another service. Reviewing OPA's documentation I did not find a direct way to convert this behavior to Rego and so I'm hoping some guidance from the community might point me in the right direction. Some questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 10 replies
-
Sure! That pattern is called dynamic policy composition. |
Beta Was this translation helpful? Give feedback.
-
Is there a limit on the length of a package name? Our folder hierarchy can be quite deep resulting in the package name being quite long. |
Beta Was this translation helpful? Give feedback.
-
Won't using a package name in this manner require multiple calls to OPA to make a decision based on the ancestor folder hierarchy? Based on the OPA API the package path is passed into the Decision function. Wondering if that might result in slower performance than a single call. |
Beta Was this translation helpful? Give feedback.
-
I have a working example of our use case in OPA now. Effectively I used Dynamic Policy Composition to delegate to an appropriate policy defined for a folder along with import statements in the policy to traverse the policies of the ancestors of the folder. Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Sure! That pattern is called dynamic policy composition.