Package io.debezium.relational.mapping
Class MaskStrings
java.lang.Object
io.debezium.relational.mapping.MaskStrings
- All Implemented Interfaces:
ColumnMapper
A
ColumnMapper
implementation that ensures that string values are masked.
Based on the constructor different masking methods could be used.- Author:
- Randall Hauch, Jan-Hendrik Dolling
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
V1 default and previous version.protected static final class
protected static final class
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMaskStrings
(byte[] salt, String hashAlgorithm, MaskStrings.HashingByteArrayStrategy hashingByteArrayStrategy) Create aColumnMapper
that masks string values by hashing the input value.MaskStrings
(String maskValue) Create aColumnMapper
that masks string values with a predefined value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
alterFieldSchema
(Column column, org.apache.kafka.connect.data.SchemaBuilder schemaBuilder) Optionally annotate the schema with properties to better capture the mapping behavior.Create for the given column a function that maps values.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.debezium.relational.mapping.ColumnMapper
initialize
-
Field Details
-
converterFromColumn
-
-
Constructor Details
-
MaskStrings
Create aColumnMapper
that masks string values with a predefined value.- Parameters:
maskValue
- the value that should be used in place of the actual value; may not be null- Throws:
IllegalArgumentException
- if the is null
-
MaskStrings
public MaskStrings(byte[] salt, String hashAlgorithm, MaskStrings.HashingByteArrayStrategy hashingByteArrayStrategy) Create aColumnMapper
that masks string values by hashing the input value. The hash is automatically shortened to the length of the column.- Parameters:
salt
- the salt that is used within the hash functionhashAlgorithm
- the hash function that is used to mask the columns string values written in source records; must be on of Java Cryptography Architecture Standard AlgorithmMessageDigest
.- Throws:
IllegalArgumentException
- if the or are null
-
-
Method Details
-
create
Description copied from interface:ColumnMapper
Create for the given column a function that maps values.- Specified by:
create
in interfaceColumnMapper
- Parameters:
column
- the column description; never null- Returns:
- the function that converts the value; may be null
-
alterFieldSchema
public void alterFieldSchema(Column column, org.apache.kafka.connect.data.SchemaBuilder schemaBuilder) Description copied from interface:ColumnMapper
Optionally annotate the schema with properties to better capture the mapping behavior.- Specified by:
alterFieldSchema
in interfaceColumnMapper
- Parameters:
column
- the column definition; never nullschemaBuilder
- the builder for theField
's schema; never null
-