Properties in Mule 4 can be encrypted to keep our sensitive data like ClientID and Client Password. Secure property module provided by mulesoftWe can be used to encrypt a .yaml or .properties file. Generally, in properties files, we store information like Client ID, Secret, UserId, UserPassword, Splunk Tokens, Oauth Token, AWS Keys, etc.

We need to encrypt the data inside any property files to restrict unauthorized access and to protect the data.

Let’s discuss how to achieve this using MuleSoft’s Secure Property.

Creating Secure Properties Is Done in Three Steps

Step 1: Create a configuration properties file.

Step 2: We can encrypt the whole file or encrypt individual property. For individual property, we can define secure properties in the file by enclosing the encrypted values between the sequence![value].

Step 3: Configure the file in the project with the Mule Secure Configuration Properties Extension module dependency. The file must point to or include the decryption key.

Create a Configuration Properties File

The first task in securing configuration properties is to create a YAML configuration file (.yaml) or a Spring-formatted Properties file (.properties), where you define the properties in src/main/resources in your Mule project. The Mule Secure Configuration Properties extension module enables you to configure YAML or Properties file types.

Refer to the below artifacts for more information.

Open Anypoint Studio -> Go to Project Folder -> src/main/resources ->Select Create New file(File extension can be either .yaml or .properties)

test.yaml

dev.properties

The following test.yaml, dev.properties files contains non encrypted configuration properties values:

test.yaml (sample yaml file)

http:

  port: "8081"

username: "Priyanka@pp"

password: "1254343654pp"

dev.properties (sample properties file)

encrypted.value1= sfdsgfdgfj1234566

encrypted.value2= xyz123568abc

testPropertyA=testValueA

testPropertyB=testValueB

#mule 4 #mulesoft 4 #mule api #anypoint mulesoft #mule security #api

How to Configure and Use Secure Properties In Mule 4
16.30 GEEK