DEV Community

Nagaraju Kshathriya
Nagaraju Kshathriya

Posted on

1 1

How to access Secure Properties in DataWeave 2.0

In this little blog, I will walk you thru how to access secure properties in dataweave 2.0.

I assume you have created and encrypted your properties. Once you configure the properties, you can read secure properties within mule component such as database, file, etc,

Accessing in Mule Components

For example, to read the secure properties in set payload - you can write xml like below,

<flow name="sample">
    <set-payload value="${secure::encrypted.key}"/>
</flow>
Enter fullscreen mode Exit fullscreen mode

Accessing in DataWeave

To access secure properties in dataweave script, you need to use p() as shown below:

%dw 2.0
output application/json
---
{
    password: p('secure::encrypted.key')
}
Enter fullscreen mode Exit fullscreen mode

That's simple. I hope you learned something from this little blog. For more MuleSoft article, news and support - visit Vanchiv.

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay