I see. I think I understand better now, thanks.
I understand what you wrote about the KVM approach, in which you codify where the contract id lies in the request as well as within the JWT… The way you’ve imagined the data format for the KVM… a single entry per tuple of {proxy, verb}… is reasonable but as you not, it results in a sort of explosion proliferation of KVM entries. Do you need all of that?
Maybe a better way to do it is to store a larger JSON in just ONE KVM entry. And maybe since in each particular proxy, the contract ID always appears in the same place regardless of the verb (the leftmost path segment or the well-known header), you could collapse all the special cases. Resulting in data that might look like this:
<br>{
"locationOfContractId" : {
"proxy1" : "path",
"proxy2" : "query",
"proxy3" : "header"
},
...other config stuff here ...
}
And the KEY for this thing is “datamap” or something generic like that.
Use a single KVM to read the configuration (and then cache it implicitly), and then use a jsonpath lookup (relying on the apiproxy.name context variable) to extract the information you want for your particular proxy.
Then use a Condition that examines the output of that jsonpath query to execute one of two ExtractVariables policies - one that extracts the contract id from the left-most path segment, the other that extracts it from the well-known header. If you also want to alow the contractID to be passed in a query, then you will need another ExtractVariables for the well-known query parameter.
And then finally validate the extracted contract ID against the contract ID asserted in the JWT.
This doesn’t sound like very much work. It feels like maybe 4-5 policies and one KVM entry. You can update the KVM as necessary, when you add proxies or extend things.
Does this make sense?
Now, one more comment, if REALLY there are just three APIs, and you don’t have a roadmap in which there will be 15 or 20 more APIs joining the party soon, then…maybe you don’t need to go meta with the configuration in the KVM. You can just define a SharedFlow and “hard-code” the condition so that it checks, “is this proxy1 or proxy2? then run the ExtractVariables to pull contractID from the path, else use ExtractVariables to pull the contract ID from the header.” In other words, embrace the Keep it Simple philosophy, unless you really expect a larger number of proxies.
helpful?