I'm using the iloveapis2015-jwr-jwe-jws jwt_signed callout library and it's working well. My only issue is that I'm using a custom claim for user roles that's an array of strings but it's only set in the jwt json as a string field. I see in the code below that the message context could return an array of strings and it should be injected into the json as such. However, setting an array in the message context using KeyValueMapOperations doesn't seem to be possible according to apigee documentation. How can the message context's variable be set as an array of Strings so the code can pick it up? Thank you for your time. Code for reference:
My KeyValueMapOperations for reference:
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="getJwtAttributes" mapIdentifier="jwt"> <Get assignTo="jwt.claim_role"> <Key> <Parameter>claim_role</Parameter> </Key> </Get>
Solved! Go to Solution.
I ended up making a step prior to the java callout which is a javascript callout.
var myVariable = context.getVariable("myVariable"); var myVariableAsArray = myVariable.split(','); context.setVariable("myVariable", myVariableAsArray);
I ended up making a step prior to the java callout which is a javascript callout.
var myVariable = context.getVariable("myVariable"); var myVariableAsArray = myVariable.split(','); context.setVariable("myVariable", myVariableAsArray);
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |