Data Masking using class mediator

In my previous post I have explained about how we can use xslt mediator for data masking. dis advantage of that is we need to use multiple xslt and to hold the key also we need use xslt file. also when considering performance it would not recommended. other thing is if you need to mask complex json that method will not support.
with this post I am going to explain data mask using class mediator. also in this method we can mask any of bellow

  • key
  • array
  • object

also in this method it will mask from anywhere in the payload and you can specify path to the object or array you want to mask. that can be configure using json file.

create maven multi module project with

  • ESB config
  • Registery
  • Mediator
  • composite application

if you are not familiar to create that type of project in developer studio you can refer blow my youtube video.

in a class mediator pom file you need to add bellow dependancies.


those are also comes with ESB itself also. so you can add those configuring build path OR add to pom file as above.
after modifying the pom file if those libraries available to import in java code, go to mediator project root directory from and run below command

mvn eclipse:eclipse

update your class mediator as below.

create sequence as follows

create API

add keysToBeMask.json file to registry (make sure the path referred in sequence)


now all set. deploy this into ESB and send bellow request

you will get a response like this

you can see array , object , key not matter what. everything masked as per the source json file

you can find this project in gitHub in this link

Share this on your world...Share on Facebook
Tweet about this on Twitter
Share on LinkedIn
Email this to someone
Print this page

Leave a Reply