Hacker News new | ask | show | jobs
by itsronenh 1565 days ago
Do package names have to match API routes? Can I create a policy that is shared by multiple endpoints?
3 comments

Technically names do not have to match, but it certainly makes it easier if you have a pattern to rely on when injecting authorization into a middleware layer.
By convention, we generate a package for every API definition in the OpenAPI spec. But the calling application can decide which package to use when authorizing an operation, so you can use a single policy for multiple endpoints.
So this is basically a tool for generating and testing Rego policies from an OpenAPI spec. Very cool!
Endpoint wise you can have N.