Skip to content

Store all policy evaluation results in the cache with unique evaluation ID

Lyuben Penkovski requested to merge 25-cache-policy-results into main

How to test it

If you run the local docker-compose environment, you can perform the following test.

Evaluate the predefined example policy in the compose environment.

curl -X POST http://localhost:8081/policy/example/example/1.0/evaluation -d '{"hello":"world"}'

You should get a response like the one below (it's not really creating a task, the response is for example purposes and is hardcoded, except for evaluationID which is real and every time will be different):

{
  "evaluationID": "a755b349-ce54-4d81-916a-d32166ada763",
  "result": {
    "allow": true,
    "taskID": "0123456789abcdef"
  }
}

Next you can retrieve the results of the policy execution from the Cache service, where for cache key you must use the evaluationID returned in the previous response:

curl -X GET http://localhost:8083/v1/cache -H 'x-cache-key: a755b349-ce54-4d81-916a-d32166ada763'

The response should be the original response of the policy execution:

{
  "allow": true,
  "taskID": "0123456789abcdef"
}

@yordan.kinkov @valerii.kalashnikov

Closes #25 (closed)

Edited by Lyuben Penkovski

Merge request reports