API masking

The API masking activity allows you to use provided custom masking logic.

This allows you to make full use of your own services and infrastructure during masking or create custom maskings if no appropriate masking exists.

Table of contents
Usage
Example
Properties

Usage

To use the API masking masking activity, it must be placed inside a table masking activity or a similar activity that iterates over data. Once placed, you must enter a new instance of an IMasking implementation using the appropriate class (the one representing the table records you are masking) or a method that returns such an object. This can be achieved by using custom code in the BizDataX package.

Example

This example will demonstrate how to create a simple IMasking implementation and use it with the API masking activity. We will mask the Email column of the Customer table by creating a new mail that will follow the format lastName_firstName_custom@mail.com.

First, we add some custom code to the Code.cs file. The custom code will include an IMasking implementation for the Customer class. It contains a property that contains the name of our custom masking, in this case Customer custom masking, and a method that changes the e-mail to the format described above. A GetMasking() method, which returns an instance of our new custom masking, is added to the Code class so we can access it from the workflow. The custom code look like this:

public class CustomerCustomMasking : IMasking<Customer>
{
    public string Name => "Customer custom masking";

    public void Mask(Customer item, IMaskingContext maskingContext)
    {
        item.Email = (item.LastName + "_" + item.FirstName + "_custom@mail.com").ToLower();
    }
}

public static class Code
{
    private static CustomerCustomMasking customerCustomMasking = new CustomerCustomMasking();
    public static IMasking<Customer> GetCustomerCustomMasking()
    {
        return customerCustomMasking;
    }
}

Next, we place the Customer masking activity on the workflow and place the API masking activity within in. We set the Masking property of this activity to Code.GetCustomerCustomMasking() to get an instance of our new custom masking and leave other properties as they are.

API masking example Figure 1: Masking Customer records with custom masking logic

Properties

Property group Property name Description Example
Input properties Masking The masking logic to use. See example.
Misc DisplayName Display name of the activity in the workflow. API masking
Result Contains the masking definition object. It's a part of the masking infrastructure and should be ignored. -