Hi guys.
I am trying to figure out the best way of controlling different configurations.
For instance I have a JWT Validation Policy that for obvious resens have different configurations depending if I am in production or preproduction. For now I have created multiple policies but I was wondering if there werent a better way?
I looked into
https://docs.apigee.com/api-platform/cache/creating-and-editing-environment-keyvalue-maps and I created a container and a new variable but when I trace my request I dont see this variable anywhere and certanily not inside the environment scope.
I tried using the variable in the policy under Issuer.
What am I doing wrong?
Solved! Go to Solution.
Are you reading the KVM values using a Key Value Map Operations policy in your proxy?
KVM's can be environment specific. But values stored in the KVM do not propagate to context/flow automatically.
You have to use Key Value Map Operations policy to read from the KVM into context variables:
<KeyValueMapOperations name="KVM-JWTAttributes" mapIdentifier="Identity"> <DisplayName>KVM-JWTAttributes</DisplayName> <Properties/> <ExclusiveCache>false</ExclusiveCache> <ExpiryTimeInSecs>360</ExpiryTimeInSecs> <Get assignTo="var_auth0_jwt_issuer" index="1"> <Key> <Parameter>auth0_jwt_issuer</Parameter> </Key> </Get> <Scope>environment</Scope> </KeyValueMapOperations>
This will set value of auth0_jwt_issuer key of kvm Identity to context/flow variable var_auth0_jwt_issuer
Please use this document and configure the policy according to your need.
You can use it at reference in generate JWT policy for Issuer.
<Issuer ref='var_auth0_jwt_issuer'/>
Now for every enviroment you can have a KVM with same name and key but with a different value and it can be evaluated at runtime.
For sensitive information please use encrypted KVM.
Hope this will help !