Comparing an inbound variable value aganist stored values(indefinite) in keyvaluemap store

Please help in the process for comparing an inbound variable value aganist the values stored in keyvaluemap store. The no of values for the key is not static.

Solved Solved
0 4 456
1 ACCEPTED SOLUTION

Not applicable
@praveen p
  1. Use key value map policy GET operation to retrieve the stored value. Assign it to variable.
  2. Inbound value can be assigned to variable using assign message policy.
  3. Compare the inbound value with this variable and take appropriate route. The comparison of variable can be done conditions tag - which can used to raise fault, change flow or route rule.
  4. Look at Key value map policy - which has support the split values of a key. You need this if you want to match you inbound variable to one of the values of key.
  5. If the matching is more involved - assign the value of the Key from key value map to a variable - use the programming power of Javascript policy to do the needful

View solution in original post

4 REPLIES 4

Not applicable

Praveen, can you please provide an example to better understand what you are trying to achieve.

say the inbound variable value can be obtained as a header variable or Query Param and the credibility of this value should be authenticated aganist all the values assiged to a key. The values of this key is dynamic. If the inbound value is a match aganist the value in key then the user can access certain resources else restrict.

Praveen

Not applicable
@praveen p
  1. Use key value map policy GET operation to retrieve the stored value. Assign it to variable.
  2. Inbound value can be assigned to variable using assign message policy.
  3. Compare the inbound value with this variable and take appropriate route. The comparison of variable can be done conditions tag - which can used to raise fault, change flow or route rule.
  4. Look at Key value map policy - which has support the split values of a key. You need this if you want to match you inbound variable to one of the values of key.
  5. If the matching is more involved - assign the value of the Key from key value map to a variable - use the programming power of Javascript policy to do the needful

Thanks Sri. I was able to achieve the same.

I was stuck on how to retrive all the values for a key from BaaS.

All we have to do is remove this command "index="1" " adn you ll be able to retrieve all the values for a key as comma separated values which can be consumed by our custom java code. Just my learning 🙂