Class DefaultMaskingFormatter
java.lang.Object
org.apache.camel.support.processor.DefaultMaskingFormatter
- All Implemented Interfaces:
org.apache.camel.spi.MaskingFormatter
public class DefaultMaskingFormatter
extends Object
implements org.apache.camel.spi.MaskingFormatter
The
MaskingFormatter that searches the specified keywords in the source and replace its value with mask
string.
By default all the known secret keys from SensitiveUtils.getSensitiveKeys() are used. Custom keywords can be
added with the addKeyword(String) method.
-
Field Summary
Fields inherited from interface org.apache.camel.spi.MaskingFormatter
CUSTOM_LOG_MASK_REF -
Constructor Summary
ConstructorsConstructorDescriptionDefaultMaskingFormatter(boolean maskKeyValue, boolean maskXml, boolean maskJson) DefaultMaskingFormatter(Set<String> keywords, boolean maskKeyValue, boolean maskXmlElement, boolean maskJson) DefaultMaskingFormatter(org.apache.camel.CamelContext camelContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKeyword(String keyword) Adds a custom keyword for masking.protected PatterncreateJsonMaskPattern(Set<String> keywords) protected PatterncreateKeyValueMaskPattern(Set<String> keywords) protected StringBuildercreateOneOfThemRegex(Set<String> keywords) protected PatterncreateXmlElementMaskPattern(Set<String> keywords) The string to use for replacement such as xxxxxprotected voidbooleanbooleanbooleanvoidsetCustomKeywords(Set<String> keywords) Adds custom keywords for masking.voidsetMaskJson(boolean maskJson) voidsetMaskKeyValue(boolean maskKeyValue) voidsetMaskString(String maskString) The string to use for replacement such as xxxxxvoidsetMaskXmlElement(boolean maskXml)
-
Constructor Details
-
DefaultMaskingFormatter
public DefaultMaskingFormatter() -
DefaultMaskingFormatter
public DefaultMaskingFormatter(org.apache.camel.CamelContext camelContext) -
DefaultMaskingFormatter
public DefaultMaskingFormatter(boolean maskKeyValue, boolean maskXml, boolean maskJson) -
DefaultMaskingFormatter
-
-
Method Details
-
addKeyword
Adds a custom keyword for masking. -
setCustomKeywords
Adds custom keywords for masking. -
getMaskString
The string to use for replacement such as xxxxx -
setMaskString
The string to use for replacement such as xxxxx -
format
- Specified by:
formatin interfaceorg.apache.camel.spi.MaskingFormatter
-
isMaskKeyValue
public boolean isMaskKeyValue() -
setMaskKeyValue
public void setMaskKeyValue(boolean maskKeyValue) -
isMaskXmlElement
public boolean isMaskXmlElement() -
setMaskXmlElement
public void setMaskXmlElement(boolean maskXml) -
isMaskJson
public boolean isMaskJson() -
setMaskJson
public void setMaskJson(boolean maskJson) -
initPatterns
protected void initPatterns() -
createKeyValueMaskPattern
-
createXmlElementMaskPattern
-
createJsonMaskPattern
-
createOneOfThemRegex
-