Skip to content

Latest commit

 

History

History
55 lines (41 loc) · 1.4 KB

README.md

File metadata and controls

55 lines (41 loc) · 1.4 KB

Download opa.exe

wget https://openpolicyagent.org/downloads/latest/opa_windows_amd64.exe

First, create your policy files in .rego and place them in ./bundles directory. Now build the .rego file with opa executable command (opa.exe).

build one file

opa build bundles/Example.rego

build directory

opa build opa/policies/ -o opa/bundles/bundle.tar.gz

this will generate ./bundles/bundles.tar.gz file that will be mounted to nginx web server, where opa engine will read the policies from.


Testing the policy directly

after building the .rego file it will be automatically mounted to nginx where the opa engine can execute it. So, to test the policy just execute the following curl

curl --location 'http://localhost:8181/v1/data/httpapi/authz' \
--header 'Content-Type: application/json' \
--data '{
    "input": {
        "user": "charlie",
        "path": ["finance", "salary", "alice"],
        "method": "GET"
    }
}'

Grpc

after writing your .proto file, you should compile it with mvn to get the java classes needed for development.

mvn clean package

Test the application by postman gRPC section

1- open postman app

2- go to New

3- select grpc

Screenshot 2023-04-07 at 3 31 26 AM