I am working on creating custom policy in mule.
In configuration XML of the policy I am seeing various mule: transformers, set variable, loggers etc. while adding in before tag (<before/>
) but dataweave.
I want to include dataweave code snippet in the configuration file (custom_policy.xml).
Can I have a chance to do that?
As per the example here you can use dataweave transform message component in your custom policy:
refer: https://github.com/JeyaramD/mule-custom-jwt-policy/blob/master/jwt-validation-policy/jwt-validation-policy.xml
<before>
.......
.......
<dw:transform-message doc:name="Transform Message" metadata:id="82cc8c48-d8bd-48aa-bf1d-ac1e7bc74f59">
<dw:input-payload doc:sample="sample_data/json.json"/>
<dw:input-variable variableName="jwtHeader"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
"-----BEGIN CERTIFICATE-----\n" ++ payload.keys[?($.kid == flowVars.jwtHeader.x5t)].x5c[0][0] ++ "\n-----END CERTIFICATE-----"]]></dw:set-payload>
</dw:transform-message>
...............
...............