Search code examples
dataweavemulesoftmule4

Use p() function mule to fetch secure property in dataweave 2.0


I have a encrypted value in my property file using mule secure property eg:

password = !#$#%%%f  (encrypted)

I want to dynamically fetch this value unencrypted using the p function in dataweave based on the input parameter passed in the request

I get the encrypted value using this syntax

Mule::p(vars.password)

How do i use the secure:: syntax on top of this to decrypt the value

{
    password: Mule::p('secure::vars.password')
}

Can someone tell the correct way to do it in Mule 4


Solution

  • To access a property defined in the secure property placeholder use the following syntax:

    p('secure::myproperty.name')
    

    If the key is dynamic use string concatenation:

    p('secure::' ++ vars.password)